Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Percentile Ranks Aggregation

More info about percentile ranks aggregation is in the official elasticsearch docs

A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents.

Simple example

{
    "aggregations" : {
        "agg_load_time_outlier" : {
            "percentile_ranks" : {
                "field" : "load_time",
                "values" : [15, 30]
            }
        }
    }
}

And now the query via DSL:

$percentileRanksAggregation = new PercentileRanksAggregation('load_time_outlier', 'load_time', [15, 30]);

$search = new Search();
$search->addAggregation($percentileRanksAggregation);

$queryArray = $search->toArray();