The term statistical facets unifies both term and statistical facets in a single one. This kind of facet is used to aggregate values using a field and compute statistic on another one.
This covers a lot of common scenarios required in facets that are generally referred as value X for feature Y.
You need a working ElasticSearch cluster and an index populated with the script available in online code.
For executing term statistical facets, we will perform the steps given as follows:
We need to compute the price as the function of available tags.
To reach our goal we need to write a request similar to the following code:
curl -XGET 'http://127.0.0.1:9200/test-index/test-type/_search?pretty=true&size=0' -d '{ "query": { "match_all": {} }, "facets": { "price_for_tag" : { "terms_stats" : { "key_field" : "tag", "value_field" : "price" } } }...