Filtering, Ranges, and Query Context
Master the difference between query and filter context and use range and term filters to narrow results efficiently.
Two Contexts
Every clause in Elasticsearch runs in one of two contexts: query context (How well does this match? produces a score) or filter context (Does this match? yes/no, no score).
Why Filters Are Fast
Filters do not compute relevance scores and their results are cached, so repeated filters are very cheap. Use filters whenever you do not need ranking from that clause.
All lessons in this course
- Introduction to Query DSL
- Term and Match Queries
- Combining Queries with Bool
- Filtering, Ranges, and Query Context