Hi!
I'd like to find documents with nested objects that don't match a specific query.
For example, I want to match documents that don't have an Alice user.
If I follow the documentation, and execute the query below, I still have the document because John Smith doesn't contain Alice:
GET my-index-000001/_search
{
"query": {
"nested": {
"path": "user",
"query": {
"bool": {
"must_not": [
{ "match": { "user.first": "Alice" }}
]
}
}
}
}
}
Result (that should be empty):
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.0,
"hits" : [
{
"_index" : "my-index-000001",
"_type" : "_doc",
"_id" : "1",
"_score" : 0.0,
"_source" : {
"group" : "fans",
"user" : [
{
"first" : "John",
"last" : "Smith"
},
{
"first" : "Alice",
"last" : "White"
}
]
}
}
]
}
How can I manage that?
Thanks by advance!