I have the next weird case: I have the fruitBox. This fruit box can have apples, pears, bananas. But it also can be empty, in this case it doesn't have any property for box.
Now lets say that i want to get from the Elasticsearch all the boxes with apples, pears and the ones that are empty.
For the boxes with fruits in it i have :
</>
{
"bool": {
"should": [
{"match_phrase": {"fruit": "apple"}},
{"match_phrase": {"fruit": "pear"}},
]
}
},
</>
Which works fine!
But if i add the condition to get also the empty boxes:
</>
"bool": {
"must_not": {
"exists": {
"field": "fruit"
}
}
}
</>
I get 0 hits.
Thank you!