Sorry, maybe the question is already somewhere there, but I could not find it. There are documents of this type:

"_source": { "id": "6521", "categories": { "ids": [ 7041, 7051 ] }, "id": "6525", "categories": { "ids": [] }, } 

I need to get those documents whose categories.ids don't matter. I could not find how to set the "terms" for such a case.

    1 answer 1

    Use Exists Query in combination with bool must_not:

     { "query": { "bool": { "must_not": { "exists" : { "field" : "categories.ids" } } } } }