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
.
Hope that helps! It's a little hard to explain