diff options
Diffstat (limited to 'docs/reference/search/aggregations/metrics/valuecount-aggregation.asciidoc')
-rw-r--r-- | docs/reference/search/aggregations/metrics/valuecount-aggregation.asciidoc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/reference/search/aggregations/metrics/valuecount-aggregation.asciidoc b/docs/reference/search/aggregations/metrics/valuecount-aggregation.asciidoc new file mode 100644 index 0000000..b3f6bf4 --- /dev/null +++ b/docs/reference/search/aggregations/metrics/valuecount-aggregation.asciidoc @@ -0,0 +1,35 @@ +[[search-aggregations-metrics-valuecount-aggregation]] +=== Value Count + +A `single-value` metrics aggregation that counts the number of values that are extracted from the aggregated documents. +These values can be extracted either from specific fields in the documents. Typically, +this aggregator will be used in conjunction with other single-value aggregations. For example, when computing the `avg` +one might be interested in the number of values the average is computed over. + +[source,js] +-------------------------------------------------- +{ + "aggs" : { + "grades_count" : { "value_count" : { "field" : "grade" } } + } +} +-------------------------------------------------- + +Response: + +[source,js] +-------------------------------------------------- +{ + ... + + "aggregations": { + "grades_count": { + "value": 10 + } + } +} +-------------------------------------------------- + +The name of the aggregation (`grades_count` above) also serves as the key by which the aggregation result can be +retrieved from the returned response. + |