From 283f2d00607af44162497bb0924c8d971f5b876d Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 10 Jul 2015 12:08:09 +0300 Subject: [PATCH] Add value count aggregation doc. --- docs/Aggregation/ValueCount.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/Aggregation/ValueCount.md diff --git a/docs/Aggregation/ValueCount.md b/docs/Aggregation/ValueCount.md new file mode 100644 index 0000000..359403e --- /dev/null +++ b/docs/Aggregation/ValueCount.md @@ -0,0 +1,28 @@ +# Value Count Aggregation + +> More info about value count aggregation is in the [official elasticsearch docs][1] + +A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + +## Simple example + +```JSON +{ + "aggs" : { + "grades_count" : { "value_count" : { "field" : "grade" } } + } +} +``` + +And now the query via DSL: + +```php +$valueCountAggregation = new ValueCountAggregation('grades_count', 'grade'); + +$search = new Search(); +$search->addAggregation($valueCountAggregation); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html -- GitLab