WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Extended Stats Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Extended Stats Aggregation Usage
editFluent DSL example
edits => s .Aggregations(a => a .ExtendedStats("commit_stats", es => es .Field(p => p.NumberOfCommits) .Sigma(1) ) )
Object Initializer syntax example
editnew 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 Responses
editresponse.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);
Was this helpful?
Thank you for your feedback.