Let's say we have nested object comment with two properties tag and group. If I do below query then it gives me the desired result.
{
"query": {
"bool": {
"must": {
"nested": {
"query": {
"bool": {
"must": {
"match": {
"comment.tag": {
"query": "SPRING",
"type": "boolean"
}
}
},
"must_not": {
"match": {
"comment.group": {
"query": "ABC",
"type": "boolean"
}
}
}
}
},
"path": "comment"
}
}
}
}
}
But if I execute below query then it doesn't give me the desired result.
{
"query": {
"bool": {
"must": {
"nested": {
"query": {
"bool": {
"must": {
"match": {
"comment.tag": {
"query": [
"SPRING",
"HIBERNATE"
],
"type": "boolean"
}
}
},
"must_not": {
"match": {
"comment.group": {
"query": [
"ABC",
"XYZ"
],
"type": "boolean"
}
}
}
}
},
"path": "comment"
}
}
}
}
}
The difference between these two is that I am querying both properties of nested object against multiple values.
With second query it just picks up the last values in the list provided to search and returns the result.
Is there a way to write query where I can specify pass list of values and all values are included in search?