You are looking at preliminary documentation for a future release.
Not what you want? See the
current release documentation.
Value Count Aggregation Usageedit
Fluent DSL Exampleedit
s => s
.Aggregations(a => a
.ValueCount("commit_count", c => c
.Field(p => p.NumberOfCommits)
)
)Object Initializer Syntax Exampleedit
new SearchRequest<Project>
{
Aggregations = new ValueCountAggregation("commit_count", Field<Project>(p => p.NumberOfCommits))
}Example json output.
{
"aggs": {
"commit_count": {
"value_count": {
"field": "numberOfCommits"
}
}
}
}
Handling Responsesedit
response.IsValid.Should().BeTrue();
var commitCount = response.Aggs.ValueCount("commit_count");
commitCount.Should().NotBeNull();
commitCount.Value.Should().BeGreaterThan(0);