Using filters to optimize your queries
ElasticSearch allows us to make different kinds of queries which you are probably familiar with. However, queries is not the only thing we are allowed to use when it comes to choosing which documents should be matched and which ones should be returned. Most of the queries exposed by ElasticSearch query DSL have their counterpart and can be used by wrapping them into the following query types:
constant_score
filtered
custom_filters_score
So the question can arise "why bother using filtering, when we can just use queries?". We will try to answer that question right now.
Filters and caching
First of all, filters are very good candidates for caching and as you may have expected, ElasticSearch provides a special cache, ...
Get Mastering ElasticSearch now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.