NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Percentile Ranks Aggregation Usage
editPercentile Ranks Aggregation Usage
editFluent DSL example
edita => a .PercentileRanks("commits_outlier", pr => pr .Field(p => p.NumberOfCommits) .Values(15, 30) .Method(m => m .TDigest(td => td .Compression(200) ) ) .Script(ss => ss.Source("doc['numberOfCommits'].value * 1.2")) .Missing(0) )
Object Initializer syntax example
editnew PercentileRanksAggregation("commits_outlier", Field<Project>(p => p.NumberOfCommits)) { Values = new List<double> { 15, 30 }, Method = new TDigestMethod { Compression = 200 }, Script = new InlineScript("doc['numberOfCommits'].value * 1.2"), Missing = 0 }
Example json output.
{ "commits_outlier": { "percentile_ranks": { "field": "numberOfCommits", "values": [ 15.0, 30.0 ], "tdigest": { "compression": 200.0 }, "script": { "source": "doc['numberOfCommits'].value * 1.2" }, "missing": 0.0 } } }
Handling Responses
editresponse.ShouldBeValid(); var commitsOutlier = response.Aggregations.PercentileRanks("commits_outlier"); commitsOutlier.Should().NotBeNull(); commitsOutlier.Items.Should().NotBeNullOrEmpty(); foreach (var item in commitsOutlier.Items) item.Should().NotBeNull();