A newer version is available. For the latest information, see the
current release documentation.
String Stats Aggregation Usageedit
Fluent DSL exampleedit
a => a .StringStats("name_stats", st => st .Field(p => p.Name) )
Object Initializer syntax exampleedit
new StringStatsAggregation("name_stats", Field<Project>(p => p.Name))
Example json output.
{ "name_stats": { "string_stats": { "field": "name" } } }
Handling Responsesedit
response.ShouldBeValid(); var commitStats = response.Aggregations.StringStats("name_stats"); commitStats.Should().NotBeNull(); commitStats.AverageLength.Should().BeGreaterThan(0); commitStats.MaxLength.Should().BeGreaterThan(0); commitStats.MinLength.Should().BeGreaterThan(0); commitStats.Count.Should().BeGreaterThan(0); commitStats.Distribution.Should().NotBeNull().And.BeEmpty();