I have nested data in some documents, in some it is not. Suppose below is the mapping.
{
"mappings": {
"item": {
"properties": {
"id": {
"type": "string"
},
"nestedType": {
"type": "nested",
"properties": {
"item1": {
"type": "long"
},
"item2": {
"type": "string"
}
}
}
}
}
}
}
I want to query on id basis, and want nested element to include in my response where item1 = 1234. But i do not want to filter response. If item1 != 1234 or item1 doesnot exist.
Actually, I don't want nested query to effect my Hits result. but to include inner hits if match found other no result in inner hits.
idand you want the nested element to be present in the response only ifnestedType.item1 = 1234? But ifnestedType.item1is not present or has a different value than 1234, you don't want the nested element to be present in the response?