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:
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, ...