Skip to content
Snippets Groups Projects
Commit 08b8fff7 authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Add cardinality aggregation doc.

parent a75f0fa5
No related branches found
No related tags found
No related merge requests found
# Cardinality Aggregation
> More info about cardinality aggregation is in the [official elasticsearch docs][1]
A single-value metrics aggregation that calculates an approximate count of distinct values.
## Simple example
```JSON
{
"aggregations" : {
"agg_author_count" : {
"cardinality" : {
"field" : "author"
}
}
}
}
```
And now the query via DSL:
```php
$cardinalityAggregation = new CardinalityAggregation('author_count', 'author');
$search = new Search();
$search->addAggregation($cardinalityAggregation);
$queryArray = $search->toArray();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment