From 19cc712d62373fc402e544678b3d6b3a265b64f1 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 10 Jul 2015 12:07:15 +0300 Subject: [PATCH] Add stats aggregation doc. --- docs/Aggregation/Stats.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/Aggregation/Stats.md diff --git a/docs/Aggregation/Stats.md b/docs/Aggregation/Stats.md new file mode 100644 index 0000000..e4ca438 --- /dev/null +++ b/docs/Aggregation/Stats.md @@ -0,0 +1,29 @@ +# Stats Aggregation + +> More info about stats aggregation is in the [official elasticsearch docs][1] + +A multi-value metrics aggregation that computes stats over numeric +values extracted from the aggregated documents. + +## Simple example + +```JSON +{ + "aggregations" : { + "agg_grades_stats" : { "stats" : { "field" : "grade" } } + } +} +``` + +And now the query via DSL: + +```php +$statsAggregation = new StatsAggregation('grades_stats', 'grade'); + +$search = new Search(); +$search->addAggregation($statsAggregation); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html -- GitLab