Filter context without bool

It seems that the minimum code I need for a filter context match is:

{
  "query": {
    "bool": {
      "filter": {
        ...
      }
    }
  }
}

That looks quite verbose and involves a bool query, even though no actual boolean combination happens at all.

Is there really no other way to start a filter context than the bool query?

Hi @AndreKR

Nope that is the way to do it AFAIK.

Little more explanation here .

In short that bool is "anding" it with the query context... if you do not have not an explicit query context it is basically a match_all query "anded" with the filter so it is in fact executing the bool.

I guess that's a good way to remember it. :man_shrugging:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.