How to add child documents to solr?

Viewed 377

I am new to Solr and the documentation can be hard to follow sometimes.

What is exactly needed to index the following json object into a core, so that the child documents appear as shown here below?:

json2 = [
 {'id' : '1', 
  'language':'nl', 
  'name' : "Caroline",
  '_childDocuments_' : 
  [
    { 'id': 'doc_1', 
     'type_s': 'document', 
     'text': "this is the text",
    }
  ]
 }
]

When I index this into the core, the '_childDocuments_' nested document does not appear. This is what I get instead:



{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"*:*",
      "_":"1603113431913"}},
  "response":{"numFound":2,"start":0,"docs":[
      {
        "id":"doc_1",
        "type_s":"document",
        "text":["this is the text"],
        "_version_":1680986266766671872},
      {
        "id":"1",
        "language":["nl"],
        "name":["Caroline"],
        "_version_":1680986266766671872}]
  }}

I read that I need to specify the _root_ in the schema, and I have, although I am not sure if I am doing it correctly. What exactly else should I be doing to index this as desired ?

0 Answers
Related