abcInfo column is of type = nested and is indexed in ES.
abcInfo =
[
{
"number": "1",
"status": "Yes"
},
{
"number": "2",
"status": "No"
},
...
]
Query Used:
{
"nested": {
"score_mode": "max",
"path": "abcInfo",
"query": {
"bool": {
"filter": [
{'term': {'abcInfo.number.keyword' : number}},
{'term': {'abcInfo.status.keyword' : status}}
]
}
}
}
}
Ideal usage of type=nested for below results
number status result
1 Yes Got
1 No -
2 Yes -
2 No Got
number
should match one object and status
should match from another object within the same list abcInfo [this is nested type as mentioned earlier]number status result
1 Yes -
1 No Got
2 Yes Got
2 No -
Index your content as nested and non-nested in two fields. You cannot control the behavior of a nested object in runtime.