Extended Stats Aggregation Usageedit

Fluent DSL exampleedit

s => s
.Aggregations(a => a
    .ExtendedStats("commit_stats", es => es
        .Field(p => p.NumberOfCommits)
        .Sigma(1)
    )
)

Object Initializer syntax exampleedit

new SearchRequest<Project>
{
    Aggregations = new ExtendedStatsAggregation("commit_stats", Field<Project>(p => p.NumberOfCommits)) { Sigma = 1 }
}

Example json output.

{
  "aggs": {
    "commit_stats": {
      "extended_stats": {
        "field": "numberOfCommits",
        "sigma": 1.0
      }
    }
  }
}

Handling Responsesedit

response.ShouldBeValid();
var commitStats = response.Aggs.ExtendedStats("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);
commitStats.SumOfSquares.Should().BeGreaterThan(0);
commitStats.StdDeviation.Should().BeGreaterThan(0);
commitStats.StdDeviationBounds.Should().NotBeNull();
commitStats.StdDeviationBounds.Upper.Should().BeGreaterThan(0);
commitStats.StdDeviationBounds.Lower.Should().NotBe(0);