WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Value Count aggregation
editValue Count aggregation
editA single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents.
Fluent DSL
editvar result = client.Search<ElasticsearchProject>(s => s .Aggregations(a => a .ValueCount("my_valuecount_agg", v => v .Field(p => p.Followers.First().Age) ) ) ); var agg = result.Aggs.ValueCount("my_valuecount_agg");
Object Initializer Syntax
editvar request = new SearchRequest { Aggregations = new Dictionary<string, IAggregationContainer> { { "my_valuecount_agg", new AggregationContainer { ValueCount = new ValueCountAggregator { Field = "followers.age" } } } } }; var result = client.Search<ElasticsearchProject>(request); var agg = result.Aggs.ValueCount("my_valuecount_agg");
Refer to the original docs for more information.