Can't seem to grasp query filters

I'm trying to understand exactly how Elasticsearch queries work, but I'm having a tough time with the concept of filters and exact values.

  • using filter within a query is boolean in the sense that it doesn't contain a score and will completely eliminate any results that don't fit the filter conditions, right?

  • must within a bool is different from filter because it will still return results which don't match the conditions, and will include a score? doesn't that make it not a boolean?

  • what is the purpose of wrapping filter in bool if the values are always boolean anyway?

  • do aggregations include results that are filtered?

In the bool world, the story goes like this:

  • must clauses imply scoring
  • filter clauses are exactly like must just they don't imply any scoring at all

In filter, you will usually shove exact queries (so called term-level queries), i.e. term queries or match queries on keyword fields, range queries, etc
In must, you will usually shove full text queries, i.e. match and match_phrase queries, query_string queries, etc

Nothing prevents you to have full-text queries in filter and term-level queries in must, but that makes less sense.

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