Value Count Aggregation Usageedit

Fluent DSL exampleedit

a => a
.ValueCount("commit_count", c => c
    .Field(p => p.NumberOfCommits)
)

Object Initializer syntax exampleedit

new ValueCountAggregation("commit_count", Field<Project>(p => p.NumberOfCommits))

Example json output.

{
  "commit_count": {
    "value_count": {
      "field": "numberOfCommits"
    }
  }
}

Handling Responsesedit

response.ShouldBeValid();
var commitCount = response.Aggregations.ValueCount("commit_count");
commitCount.Should().NotBeNull();
commitCount.Value.Should().BeGreaterThan(0);