NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Value Count Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Value Count Aggregation Usage
editFluent DSL example
edita => a
.ValueCount("commit_count", c => c
.Field(p => p.NumberOfCommits)
)
Object Initializer syntax example
editnew ValueCountAggregation("commit_count", Field<Project>(p => p.NumberOfCommits))
Example json output.
{
"commit_count": {
"value_count": {
"field": "numberOfCommits"
}
}
}
Handling Responses
editresponse.ShouldBeValid();
var commitCount = response.Aggregations.ValueCount("commit_count");
commitCount.Should().NotBeNull();
commitCount.Value.Should().BeGreaterThan(0);