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 Usage
editValue Count Aggregation Usage
editFluent DSL example
edits => s .Aggregations(a => a .ValueCount("commit_count", c => c .Field(p => p.NumberOfCommits) ) )
Object Initializer syntax example
editnew SearchRequest<Project> { Aggregations = new ValueCountAggregation("commit_count", Field<Project>(p => p.NumberOfCommits)) }
Example json output.
{ "aggs": { "commit_count": { "value_count": { "field": "numberOfCommits" } } } }
Handling Responses
editresponse.IsValid.Should().BeTrue(); var commitCount = response.Aggs.ValueCount("commit_count"); commitCount.Should().NotBeNull(); commitCount.Value.Should().BeGreaterThan(0);