Curious about query differences


(kurtis) #1

Just wondering why these two queries give different results. Hoping someone can explain.

The one that works
{
"query": {
"bool": {
"must_not": {
"nested": {
"path": "breadcrumbs",
"query": {
"exists": {
"field": "breadcrumbs"
}
}
}
}
}
}
}

and

The one that doesnt
{
"query":{
"nested":{
"path":"breadcrumbs",
"query":{
"bool":{
"must_not":[
{
"exists":{
"field":"breadcrumbs"
}
}
]
}
}
}
}
}


(Alexander Reelsen) #2

please take some time to write a full blown reproducible example, but also write down what your expectations are? What do you expect when you query for a field, and the inside query is not to exist for this field? Which documents should match that and which should not?

Thanks for helping!