NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Percentiles Aggregation Usage
editPercentiles Aggregation Usage
editFluent DSL example
edita => a .Percentiles("commits_outlier", pr => pr .Field(p => p.NumberOfCommits) .Percents(95, 99, 99.9) .Method(m => m .HDRHistogram(hdr => hdr .NumberOfSignificantValueDigits(3) ) ) .Script(ss => ss.Source("doc['numberOfCommits'].value * 1.2")) .Missing(0) )
Object Initializer syntax example
editnew PercentilesAggregation("commits_outlier", Field<Project>(p => p.NumberOfCommits)) { Percents = new[] { 95, 99, 99.9 }, Method = new HDRHistogramMethod { NumberOfSignificantValueDigits = 3 }, Script = new InlineScript("doc['numberOfCommits'].value * 1.2"), Missing = 0 }
Example json output.
{ "commits_outlier": { "percentiles": { "field": "numberOfCommits", "percents": [ 95.0, 99.0, 99.9 ], "hdr": { "number_of_significant_value_digits": 3 }, "script": { "source": "doc['numberOfCommits'].value * 1.2" }, "missing": 0.0 } } }
Handling Responses
editresponse.ShouldBeValid(); var commitsOutlier = response.Aggregations.Percentiles("commits_outlier"); commitsOutlier.Should().NotBeNull(); commitsOutlier.Items.Should().NotBeNullOrEmpty(); foreach (var item in commitsOutlier.Items) item.Value.Should().BeGreaterThan(0);