Nested data with two level

Hi Guys,
In this data when i am trying with one level nested data then it's working fine but when i am adding one more nested data then it's not working if anybody will be knows about that then please reply me.I am sending my document data and mapping file also.

POST /test_word14/doc/1
{
"name": "Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism (D50-D89)",
"depth": 1,
"children": [{
"name": "Nutritional anemias (D50-D53)",
"depth": 2,
"children": [{
"code": "D50.0",
"name": "Iron deficiency anemia secondary to blood loss (chronic)",
"depth": 4
}, {
"code": "D50.1",
"name": "Sideropenic dysphagia",
"depth": 4
}, {
"code": "D50.8",
"name": "Other iron deficiency anemias",
"depth": 4
}, {
"code": "D50.9",
"name": "Iron deficiency anemia, unspecified",
"depth": 4
}]
}]
}

(mapping file)
PUT /test_word16
{
"mappings": {
"doc": {
"properties": {
"name": { "type": "string" },
"depth": {"type":"long"},
"children": {
"type": "nested",
"properties": {
"name": { "type": "string" },
"depth": { "type": "long" },
"children": {
"type": "nested",
"properties": {
"code": { "type": "string" },
"name": { "type": "string" },
"depth": { "type": "long" },
}
}
}
}
}
}
}
}

please tell me what is the query i am applying here.i applied the query like this:
GET /icd10_codes/doc/_search
{
"_source": false,
"query": {
"nested": {
"path": "children",
"query": {
"nested": {
"path": "children.children",
"query": {
"nested": {
"path": "children.children.children",
"query": {
"bool": {
"must": [
{
"match": {
"children.children.name": "Iron"
}
}
]
}
},
"inner_hits": {
"_source": {
"excludes":["name"]
}
}
}
}
}
}
}
}

So your search response did include hits but did not include inner hits?

Based on your search request, I think you need to define inner_hits on all nested queries, otherwise the inner hits of the most inner nested query don't get picked up.

I also define like that but still i am not getting
GET /icd10_codes/doc/_search?_source=false
{
"query": {
"nested": {
"path": "children",
"query": {
"bool": {
"must": [
{
"match": {
"children.name": "Nutritional anemias (D50-D53)"
}
},
{
"nested": {
"path": "children.children",
"query": {
"match": {
"children.children.name": "Sideropenic dysphagia"
}
}
}
}
]
}
}
}
},
"inner_hits": {
"kids": {
"path": {
"children": {
"query": {
"match": {
"children.name": "Nutritional anemias (D50-D53)"
}
},
"inner_hits": {
"grand_kids": {
"path": {
"children.children": {
"query": {
"match": {
"children.children.name": "Sideropenic dysphagia"
}
}
}
}
}
}
}
}
}
}
}

But when i am defining like that then it's showing:
"type": "parsing_exception",
"reason": "Unknown key for a START_OBJECT in [inner_hits]

You are not using inner hits as expected. Follow the inner_hits documentation, this will help you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.