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);