From 2b35078cdc4472422e7e2c5714ae2de3c06918af Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 10 Jul 2015 12:05:00 +0300 Subject: [PATCH] Add Histogram aggregation doc. --- docs/Aggregation/Histogram.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/Aggregation/Histogram.md diff --git a/docs/Aggregation/Histogram.md b/docs/Aggregation/Histogram.md new file mode 100644 index 0000000..be18516 --- /dev/null +++ b/docs/Aggregation/Histogram.md @@ -0,0 +1,34 @@ +# Histogram Aggregation + +> More info about histogram aggregation is in the [official elasticsearch docs][1] + +A multi-bucket values source based aggregation that can be applied on numeric values extracted from +the documents. It dynamically builds fixed size (a.k.a. interval) buckets over the values. + +## Simple example + +```JSON +{ + "aggregations": { + "agg_prices": { + "histogram": { + "field": "price", + "interval": 50 + } + } + } +} +``` + +And now the query via DSL: + +```php +$histogramAggregation = new HistogramAggregation('prices', 'price', 50); + +$search = new Search(); +$search->addAggregation($histogramAggregation); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html -- GitLab