Filter and scopes in ElasticSearch faceting mechanism
When using ElasticSearch faceting mechanism there are a few things one needs to remember. First of all remember that the faceting results will only be calculated for your query results. If you include filters outside of the
query object, inside the
filter object, such filters will not be used to limit the documents on which faceting is calculated. The other thing to remember about is the scope, which can help you with extending the documents on which faceting calculation is done. So let's get into examples.
Let's begin with recalling how queries, filters, and facets work together. To do that we will index a few documents to the
books index by using the following commands:
curl -XPUT ...