Let's have a look at the filtering functionality provided by Elasticsearch. At first it may seem like a redundant functionality because almost all the filters have their query counterpart present in Elasticsearch Query DSL. But there must be something special about those filters because they are commonly used and they are advised when it comes to query performance. This section will discuss why filtering is important, how filters work, and what type of filtering is exposed by Elasticsearch.
The first difference when comparing queries to filters is the influence on the document score. Let's compare queries and filters to see what to expect. We will start with the following query:
curl -XGET "http://127.0.0.1:9200/library/_search?pretty" -d' { "query": { "term": { "title": { "value": "front" } } } }'
The results for that query are as follows:
{ "took" : 1, "timed_out...