Sum Aggregation Usage

edit

Fluent DSL example

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

Object Initializer syntax example

edit
new SumAggregation("commits_sum", Field<Project>(p => p.NumberOfCommits))

Example json output.

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

Handling Responses

edit
response.ShouldBeValid();
var commitsSum = response.Aggregations.Sum("commits_sum");
commitsSum.Should().NotBeNull();
commitsSum.Value.Should().BeGreaterThan(0);