WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Sum Aggregation Usage
editSum Aggregation Usage
editFluent DSL example
edits => s .Aggregations(a => a .Sum("commits_sum", sm => sm .Field(p => p.NumberOfCommits) ) )
Object Initializer syntax example
editnew SearchRequest<Project> { Aggregations = new SumAggregation("commits_sum", Field<Project>(p => p.NumberOfCommits)) }
Example json output.
{ "aggs": { "commits_sum": { "sum": { "field": "numberOfCommits" } } } }
Handling Responses
editresponse.ShouldBeValid(); var commitsSum = response.Aggs.Sum("commits_sum"); commitsSum.Should().NotBeNull(); commitsSum.Value.Should().BeGreaterThan(0);