Value Count Aggregation Usage

edit

Fluent DSL example

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

Object Initializer syntax example

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

Example json output.

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

Handling Responses

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