String Stats Aggregation Usage

edit

Fluent DSL example

edit
a => a
.StringStats("name_stats", st => st
    .Field(p => p.Name)
)

Object Initializer syntax example

edit
new StringStatsAggregation("name_stats", Field<Project>(p => p.Name))

Example json output.

{
  "name_stats": {
    "string_stats": {
      "field": "name"
    }
  }
}

Handling Responses

edit
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();