Filter context is in effect whenever a query clause is passed to a filter parameter, such as the filter or must_not parameters in the bool query, the filter parameter in the constant_score query, or the filter aggregation.
What about queries under post_filter? Should I infer from the name that these will be under filter context? I could imagine cases where you might want scoring here, so I just wanted to be sure. Thanks!
The queries added to the apost_filter will be entirely in the "filter" context (e.g. non-scoring). The post_filter only exists to allow filtering the search hit results differently from the agg results. But the ranking/scoring of those results don't matter since aggs collect any matching document regardless of their score.
E.g. if you want agg results to be filtered in a certain way, you can include that in the regular query. If you want the search results to be filtered but the aggs to represent all the data, use a post_filter. The actual ranking of the search results is unimportant to aggregations, so you can include the necessary scoring elements in the regular query.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.