IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
String Stats Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
String Stats Aggregation Usage
editFluent DSL example
edita => a
.StringStats("name_stats", st => st
.Field(p => p.Name)
)
Object Initializer syntax example
editnew StringStatsAggregation("name_stats", Field<Project>(p => p.Name))
Example json output.
{
"name_stats": {
"string_stats": {
"field": "name"
}
}
}
Handling Responses
editresponse.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();