What query string can I supply to ensure no results?

Hello our application pipes things directly to elasticsearch query strings like so:

"title:test and word:filter"

But in some cases we want to pipe the filter in such a way that it never returns a hit, e.g. something like:

"title:test AND impossible_match"

So the query will always return zero results.

Is there such a keyword?

Why run the search at all if you do not want any matches?

1 Like

We still need Elasticsearch to register the search as we use it as a source of truth for auditing

May be instead of query string, switch in that case to an exists field query and ask for a non existing field?