Hi Thomas

Got it, that was very very helpful! Thank you so much:-)

Christoph

-----Ursprüngliche Nachricht-----
Von: Thomas Corthals <[email protected]> 
Gesendet: Samstag, 18. Februar 2023 9:50 PM
An: [email protected]
Betreff: Re: Nested Fields Schema Definition

Hi Christoph

All fields of the parent and child documents must match a field or dynamicField 
definition in the schema. Those field definitions are the same for all types of 
documents, whether it is a parent or a child. This doesn't only mean they have 
to be the same fieldType, it also means you can only make a field required if 
it is required for all types of documents.

However, "indications" isn't actually a field, child documents just use the 
same syntax as field values. This "pseudo field" doesn't need to be defined in 
the schema, there is no "child document" field type.

Thomas

Op za 18 feb. 2023 om 21:10 schreef <[email protected]
>:

> Hello everyone
>
>
> For quite some time I am struggling with a problem of indexing a 
> nested structure in Solr and defining the Schema accordingly 
> beforehand by using the Schema API.
>
>
> In particular let's consider the following document:
>
> {
>     "id": "doc_1",
>     "title": "Am I a banana or not?",
>     "indications": [
>         { "id": "ind_1", "title": "Yes you are", "text": "True story"  },
>         { "id": "ind_2", "title": "No you aren't", "text": "Because 
> she said so"},
>     ]
> }
>
>
> and have two main issues
>
>   1.  First I don't know how the nested fields should be defined in 
> the managed-schema.xml and if the field "indications" should also be defined
>   2.  Is it possible to give a different definition for the top level 
> "text" field with respect to the "text" field inside each "indication"?
>
> I really hope that someone can help me with that because I am really 
> struggling with it.
>
> Thank you very much already
>
> Christopn
>

Reply via email to