From f7782991452e35cad1e705bcb9260f8778429064 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 10 Jul 2015 12:07:27 +0300 Subject: [PATCH] Add sum aggregation doc. --- docs/Aggregation/Sum.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/Aggregation/Sum.md diff --git a/docs/Aggregation/Sum.md b/docs/Aggregation/Sum.md new file mode 100644 index 0000000..bc5929a --- /dev/null +++ b/docs/Aggregation/Sum.md @@ -0,0 +1,28 @@ +# Sum Aggregation + +> More info about sum aggregation is in the [official elasticsearch docs][1] + +A single-value metrics aggregation that sums up numeric values that are extracted from the aggregated documents. + +## Simple example + +```JSON +{ + "aggregations" : { + "agg_intraday_return" : { "sum" : { "field" : "change" } } + } +} +``` + +And now the query via DSL: + +```php +$sumAggregation = new SumAggregation('intraday_return', 'change'); + +$search = new Search(); +$search->addAggregation($sumAggregation); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-sum-aggregation.html -- GitLab