Sum Aggregation Usageedit

Fluent DSL exampleedit

s => s
.Aggregations(a => a
    .Sum("commits_sum", sm => sm
        .Field(p => p.NumberOfCommits)
    )
)

Object Initializer syntax exampleedit

new SearchRequest<Project>
{
    Aggregations = new SumAggregation("commits_sum", Field<Project>(p => p.NumberOfCommits))
}

Example json output. 

{
  "aggs": {
    "commits_sum": {
      "sum": {
        "field": "numberOfCommits"
      }
    }
  }
}

Handling Responsesedit

response.IsValid.Should().BeTrue();
var commitsSum = response.Aggs.Sum("commits_sum");
commitsSum.Should().NotBeNull();
commitsSum.Value.Should().BeGreaterThan(0);