Filter context

Filter context is in effect whenever a query clause is passed to a filter parameter, such as the filter or must_notparameters in the bool query, the filter parameter in the constant_score query, or the filter aggregation.

In filter context, a query clause answers the question “Does this document match this query clause?” The answer is a simple Yes or No — no scores are calculated. Filter context is mostly used for filtering structured data, e.g.

  • Does this timestamp fall into the range 2015 to 2016?

  • Is the status field set to "published"?

Frequently used filters will be cached automatically by Elasticsearch, to speed up performance.

Last updated