Hi Matthew

If you set json.command=false your JSON will be treated as custom JSON.
You'll have to remove that parameter to have it treated as Solr JSON. You
can use the full command index:

curl --location --request POST ' xxxx:8983/solr/talix/update' \
--header 'Content-Type: application/json' \
--data-raw '
{
    "add":{
        "doc":{
            "doc_id":"parent",
            "Name":"Parent",
            "child":{
                "doc_id":"child",
                "Name":"Child"
            }
        }
    }
}'

Or you can wrap your document(s) in a JSON array:

curl --location --request POST ' xxxx:8983/solr/talix/update' \
--header 'Content-Type: application/json' \
--data-raw '
[
    {
        "doc_id":"parent",
        "Name":"Parent",
        "child":{
            "doc_id":"child",
            "Name":"Child"
        }
    }
]'

Thomas

Op ma 31 okt. 2022 om 19:27 schreef Matthew Castrigno <castr...@slhs.org>:

> Hi Thomas,
> I am attempting to define my fields to accept the data that will actually
> be sent, it is more deeply nested.
> In doing so I have interpreted the results of the previous configuration
> to not include (pseudo-)fields. In the JSON below I believe those to be
> "content" from the prior example, along with "Page, Body, Modules and
> Fields" but his gives me the error shown. How do I handle these other
> fields. Thank you for your assistance, it is greatly appreciated.
>
>
>     <field name="partner" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>     <field name="command" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>     <field name="doc_id" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
> <!--
>     <field name="content" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
> -->
>     <field name="Id" type="string" indexed="true" stored="true" required=
> "false" multiValued="false" />
>     <field name="Name" type="string" indexed="true" stored="true" required
> ="false" multiValued="false" />
>     <field name="Url" type="string" indexed="true" stored="true" required=
> "false" multiValued="false" />
>     <field name="Date" type="string" indexed="true" stored="true" required
> ="false" multiValued="false" />
>     <field name="ContentType" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>     <field name="Facets" type="strings" indexed="true" stored="true"
> required="false" multiValued="false" />
>     <field name="Title" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>     <field name="Summary" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>
>     <field name="Type" type="string" indexed="true" stored="true" required
> ="false" multiValued="false" />
>     <field name="Value" type="string" indexed="true" stored="true"
> required="false" multiValued="false" />
>
>     <!-- docValues are enabled by default for long type so we don't need
> to index the version field  -->
>     <field name="_version_" type="plong" indexed="false" stored="false"/>
>
>     <!-- If you don't use child/nested documents, then you should remove
> the next two fields:  -->
>     <!-- for nested documents (minimal; points to root document) -->
>     <field name="_root_" type="string" indexed="true" stored="false"
> docValues="false" />
>     <!-- for nested documents (relationship tracking) -->
>     <field name="_nest_path_" type="_nest_path_" /><fieldType name=
> "_nest_path_" class="solr.NestPathField" />
>
>     <field name="_text_" type="text_general" indexed="true" stored="false"
>  multiValued="true"/>
>
> curl --location --request POST '
> http://localhost:8983/solr/talix/update?json.command=false' \
> --header 'Content-Type: application/json' \
> --data-raw '{
>   "partner": "88027688-62c4-459a-b4d5-a8ecf9edd1bf",
>   "command": "add",
>   "doc_id": "2ff99d1a-a21b-4391-9c47-af2865acb753",
>   "content": {
>     "Page": {
>       "Id": "2ff99d1a-a21b-4391-9c47-af2865acb753",
>       "Name": "Ronald McDonald House Idaho meals",
>       "Url":
> "/blogs/st-lukes/news-and-community/2021/jan/ronald-mcdonald-house-idaho-meals",
>       "Date": "2022-10-03T12:30:17.3388537",
>       "ContentType": "Blog",
>       "Body": {
>         "Fields": [
>           { "Name": "Heading Background Image", "Type": "Image", "Value":
> "" },
>           { "Name": "Tile Wide Image", "Type": "Image", "Value": "" },
>           { "Name": "Specialties", "Type": "Treelist", "Value": "" },
>           {
>             "Name": "Blog Post Name",
>             "Type": "Single-Line Text",
>             "Value": "Ronald McDonald House, St. Luke’s Children’s find
> new ways to help families"
>           },
>           { "Name": "Blog Summary", "Type": "Rich Text", "Value": "" },
>           { "Name": "Share Summary", "Type": "Multi-Line Text", "Value":
> "" }
>         ],
>         "Modules": {
>           "Fields": [
>             { "Name": "Content", "Type": "Rich Text", "Value": "" },
>             { "Name": "Image Position", "Type": "Droptree", "Value":
> "Right" },
>             { "Name": "Image Source", "Type": "Image", "Value": "" },
>             {
>               "Name": "Image Content",
>               "Type": "Rich Text",
>               "Value": "<p>For more than three decades</p>"
>             }
>           ]
>         }
>       },
>       "Facets": ["Blogs", "Article"],
>       "Title": "Ronald McDonald House, St. Luke’s Children’s find new ways
> to help families",
>       "Summary": ""
>     }
>   }
> }'
>
> Response:
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":0},
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.common.SolrException",
>       "root-error-class","org.apache.solr.common.SolrException"],
>     "msg":"undefined field: \"content.Page.Id\"",
>     "code":400}}
> ------------------------------
> *From:* Matthew Castrigno <castr...@slhs.org>
> *Sent:* Thursday, October 27, 2022 10:36 AM
> *To:* Thomas Corthals <tho...@klascement.net>
> *Cc:* users@solr.apache.org <users@solr.apache.org>
> *Subject:* Re: I cannot get nested objects to index - with image links
>
> Thank you, Thomas! Changing the required to false allowed the document to
> be indexed. I did not gleam this information from the SOLR documentation
> regarding nested documents. Do you know of any good sources for educational
> material on this subject? I cannot change the payloads that I am working
> with unfortunately. They make heavy use of deeply nested json object. Thank
> you again for your assistance, it is most appreciated!
> ------------------------------
> *From:* Thomas Corthals <tho...@klascement.net>
> *Sent:* Thursday, October 27, 2022 1:34 AM
> *To:* Matthew Castrigno <castr...@slhs.org>
> *Cc:* users@solr.apache.org <users@solr.apache.org>
> *Subject:* Re: I cannot get nested objects to index - with image links
>
> Hi Matthew All the fields in your schema are required="true". This means
> they are required for all documents, whether parents or children (or
> standalone). "Required" fields (from a business logic perspective) on
> parents
> ZjQcmQRYFpfptBannerStart
> This Message Is From an Untrusted Sender
> You have not previously corresponded with this sender.
>
> ZjQcmQRYFpfptBannerEnd
> Hi Matthew
>
> All the fields in your schema are required="true". This means they are
> required for all documents, whether parents or children (or standalone).
> "Required" fields (from a business logic perspective) on parents and
> children will usually be different and that can't be enforced in a Solr
> schema.
>
> The only fields that can be required="true" are the ones that are required
> for all types of documents. The uniqueKeyField is definitely one of them.
> For all other fields, it might make more sense to handle this constraint in
> your application.
>
> Thomas
>
> Op do 27 okt. 2022 om 01:08 schreef Matthew Castrigno <castr...@slhs.org>:
>
> Thank you so much for your response, Thomas, I do appreciate it.
> I made the changes, but I am getting a different error now. Did I not
> interpret your instructions correctly?
> https://i.postimg.cc/SNM4t7vs/updated-schema.png [i.postimg.cc]
> <https://urldefense.com/v3/__https://i.postimg.cc/SNM4t7vs/updated-schema.png__;!!FkC3_z_N!JJcOTo8MLWYS72yOLdGmPbY8vOwX_B_w1HO2eCNy2NK_4nSWBTu3eKknYiA8rgpJ4E66YWvLPJeAa1Gl$>
>
> https://i.postimg.cc/RZtcF8bB/Screenshot-2022-10-26-170222.png
> [i.postimg.cc]
> <https://urldefense.com/v3/__https://i.postimg.cc/RZtcF8bB/Screenshot-2022-10-26-170222.png__;!!FkC3_z_N!JJcOTo8MLWYS72yOLdGmPbY8vOwX_B_w1HO2eCNy2NK_4nSWBTu3eKknYiA8rgpJ4E66YWvLPNYoRUGC$>
>
> ------------------------------
> *From:* Thomas Corthals <tho...@klascement.net>
> *Sent:* Tuesday, October 25, 2022 1:28 AM
> *To:* users@solr.apache.org <users@solr.apache.org>
> *Subject:* Re: I cannot get nested objects to index - with image links
>
> Hi Matthew The (pseudo-)field in which you want to put the nested
> documents ("content" in your example) should not be added to the schema.
> The actual fields of the nested document (id, stuff1, stuff2) need to match
> an explicit field definition
> ZjQcmQRYFpfptBannerStart
> This Message Is From an Untrusted Sender
> You have not previously corresponded with this sender.
>
> ZjQcmQRYFpfptBannerEnd
>
> Hi Matthew
>
> The (pseudo-)field in which you want to put the nested documents ("content"
> in your example) should not be added to the schema. The actual fields of
> the nested document (id, stuff1, stuff2) need to match an explicit field
> definition or a dynamicField definition in your schema though.
>
> Thomas
>
> Op ma 24 okt. 2022 om 23:48 schreef Matthew Castrigno <castr...@slhs.org>:
>
> > Hello Community, Thank you for taking the time to read my message.
> >
> > I am attempting to index (update) a document with a nested object.
> >
> > In reading the documentation is seems to state that the fields of the
> > nested object do not need to be and should not be added
> >
> > to schema.xml.  I am getting error that the field of the nested object is
> > undefined, and I am not sure what I am doing wrong.
> >
> > Any insights appreciated. Thank you
> >
> > https://urldefense.com/v3/__https://i.postimg.cc/25GtB1Mc/update.png__;!!FkC3_z_N!MH9mbztbPvc05Og3x_fcnapmPzux7fhqgdChsAIR0bqiTiV_-BVnIdI8Z---HIWeD5TLbiwytoGIDSsB$
> >
> > https://urldefense.com/v3/__https://i.postimg.cc/SKk5s6TY/schema.png__;!!FkC3_z_N!MH9mbztbPvc05Og3x_fcnapmPzux7fhqgdChsAIR0bqiTiV_-BVnIdI8Z---HIWeD5TLbiwytlHh85s3$
> >
> > ----------------------------------------------------------------------
> > "This message is intended for the use of the person or entity to which it
> > is addressed and may contain information that is confidential or
> > privileged, the disclosure of which is governed by applicable law. If the
> > reader of this message is not the intended recipient, you are hereby
> > notified that any dissemination, distribution, or copying of this
> > information is strictly prohibited. If you have received this message by
> > error, please notify us immediately and destroy the related message."
> >
>
> ------------------------------
> "This message is intended for the use of the person or entity to which it
> is addressed and may contain information that is confidential or
> privileged, the disclosure of which is governed by applicable law. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution, or copying of this
> information is strictly prohibited. If you have received this message by
> error, please notify us immediately and destroy the related message."
>
> ------------------------------
> "This message is intended for the use of the person or entity to which it
> is addressed and may contain information that is confidential or
> privileged, the disclosure of which is governed by applicable law. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution, or copying of this
> information is strictly prohibited. If you have received this message by
> error, please notify us immediately and destroy the related message."
>

Reply via email to