Sunday, March 18, 2018

FW: Indexing multi level Nested JSON

-----Original Message-----
From: Zheng Lin Edwin Yeo [mailto:edwinyeozl@gmail.com]
Sent: 19 March 2018 08:46
To: solr-user@lucene.apache.org
Subject: Indexing multi level Nested JSON

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","pho
ne_s":"456"}]
},
{
"id": "3a",
"comments_s": "SolrCloud supports it too 2!",
"_childDocuments_":[{"name_s":"alan","phone_s":"123"},{"name_s":"edwin","pho
ne_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","pho
ne_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","pho
ne_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

No comments:

Post a Comment