NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Stats Aggregation Usageedit
Fluent DSL exampleedit
a => a .Stats("commit_stats", st => st .Field(p => p.NumberOfCommits) )
Object Initializer syntax exampleedit
new StatsAggregation("commit_stats", Field<Project>(p => p.NumberOfCommits))
Example json output.
{ "commit_stats": { "stats": { "field": "numberOfCommits" } } }
Handling Responsesedit
response.ShouldBeValid(); var commitStats = response.Aggregations.Stats("commit_stats"); commitStats.Should().NotBeNull(); commitStats.Average.Should().BeGreaterThan(0); commitStats.Max.Should().BeGreaterThan(0); commitStats.Min.Should().BeGreaterThan(0); commitStats.Count.Should().BeGreaterThan(0); commitStats.Sum.Should().BeGreaterThan(0);