Edwin,
You need to add necessary fields into child/grands to keep multiple levels
and reconstruct them in result post processing.
There is nothing ready-made for it.


On Tue, Mar 20, 2018 at 7:02 AM, Zheng Lin Edwin Yeo <edwinye...@gmail.com>
wrote:

> I have found that we can index multi level Nested JSON with child of child
> relationship.
>
> However, how can we identify it from the output that it is the child of
> child relationship? From what I have see, all the line results are tied and
> pointed to the parents, so it seems that all are the parent-child
> relationship, and I can't identify which are the child of child
> relationship.
>
> Regards,
> Edwin
>
> On 19 March 2018 at 11:16, Zheng Lin Edwin Yeo <edwinye...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I have this sample multi level Nested JSON, with 2 level of child
> > Documents.
> >
> > [
> >   {
> >     "id": "1",
> >     "title_s": "Solr adds block join support",
> >     "contenttype_s": "parentDocument",
> >     "_childDocuments_": [
> >       {
> >         "id": "3",
> >         "comments_s": "SolrCloud supports it too!",
> > "_childDocuments_":[{"name_s":"alan","phone_s":"123"},{"
> > name_s":"edwin","phone_s":"456"}]
> >       },
> >   {
> >         "id": "3a",
> >         "comments_s": "SolrCloud supports it too 2!",
> > "_childDocuments_":[{"name_s":"alan","phone_s":"123"},{"
> > name_s":"edwin","phone_s":"456"}]
> >       }
> >     ]
> >   },
> >   {
> >     "id": "2",
> >     "title_s": "New Lucene and Solr release is out",
> >     "contenttype_s": "parentDocument",
> >     "_childDocuments_": [
> >       {
> >         "id": "4",
> >         "comments_s": "Lots of new features",
> > "_childDocuments_":[{"name_s":"alan","phone_s":"123"},{"
> > name_s":"edwin","phone_s":"456"}]
> >       }
> >     ]
> >   },
> >   {
> >     "id": "5",
> >     "title_s": "Testing of Nested JSON",
> >     "contenttype_s": "parentDocument",
> >     "_childDocuments_": [
> >       {
> >         "id": "6",
> >         "comments_s": "See if this is a child",
> > "_childDocuments_":[{"name_s":"alan","phone_s":"123"},{"
> > name_s":"edwin","phone_s":"456"}]
> >       }
> >     ]
> >   }
> > ]
> >
> >
> > However, when it is indexed into Solr, there is only one level, and the
> > output becomes like this.
> >
> > {
> >   "responseHeader":{
> >     "zkConnected":true,
> >     "status":0,
> >     "QTime":1,
> >     "params":{
> >       "q":"contenttype_s:parentDocument",
> >       "fl":"*,[child parentFilter=contenttype_s:parentDocument]",
> >       "sort":"id asc"}},
> >   "response":{"numFound":3,"start":0,"docs":[
> >       {
> >         "id":"1",
> >         "title_s":"Solr adds block join support",
> >         "contenttype_s":"parentDocument",
> >         "signature":"0000000000000000",
> >         "_version_":1595334082096529408,
> >         "_childDocuments_":[
> >         {
> >           "name_s":"alan",
> >           "phone_s":"123",
> >           "_version_":1595334082096529408},
> >         {
> >           "name_s":"edwin",
> >           "phone_s":"456",
> >           "_version_":1595334082096529408},
> >         {
> >           "id":"3",
> >           "comments_s":"SolrCloud supports it too!",
> >           "_version_":1595334082096529408},
> >         {
> >           "name_s":"alan",
> >           "phone_s":"123",
> >           "_version_":1595334082096529408},
> >         {
> >           "name_s":"edwin",
> >           "phone_s":"456",
> >           "_version_":1595334082096529408},
> >         {
> >           "id":"3a",
> >           "comments_s":"SolrCloud supports it too 2!",
> >           "_version_":1595334082096529408}]},
> >       {
> >         "id":"2",
> >         "title_s":"New Lucene and Solr release is out",
> >         "contenttype_s":"parentDocument",
> >         "signature":"0000000000000000",
> >         "_version_":1595334082099675136,
> >         "_childDocuments_":[
> >         {
> >           "name_s":"alan",
> >           "phone_s":"123",
> >           "_version_":1595334082099675136},
> >         {
> >           "name_s":"edwin",
> >           "phone_s":"456",
> >           "_version_":1595334082099675136},
> >         {
> >           "id":"4",
> >           "comments_s":"Lots of new features",
> >           "_version_":1595334082099675136}]},
> >       {
> >         "id":"5",
> >         "title_s":"Testing of Nested JSON",
> >         "contenttype_s":"parentDocument",
> >         "signature":"0000000000000000",
> >         "_version_":1595334082101772288,
> >         "_childDocuments_":[
> >         {
> >           "name_s":"alan",
> >           "phone_s":"123",
> >           "_version_":1595334082101772288},
> >         {
> >           "name_s":"edwin",
> >           "phone_s":"456",
> >           "_version_":1595334082101772288},
> >         {
> >           "id":"6",
> >           "comments_s":"See if this is a child",
> >           "_version_":1595334082101772288}]}]
> >   }}
> >
> >
> > Is Solr able to support the indexing of multi level Nested JSON?
> >
> > I have tested this on Solr 6.5.1.
> >
> > Regards,
> > Edwin
> >
>



-- 
Sincerely yours
Mikhail Khludnev

Reply via email to