Safe empty query


(justinpa) #1

Is there a safe/standard way to create a bool query that is guaranteed to give an empty result set? Nesting an empty query into a bool query's should gives me parse errors.


(Blahord) #2

You can do the following:

{"query":{"bool":{"must_not":[{"match_all": {}}]}}}


(system) #3