WARNING: Version 1.3 of Elasticsearch 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.
Percentile Ranks Aggregation
editPercentile Ranks Aggregation
editAdded in 1.3.0.
A multi-value
metrics aggregation that calculates one or more percentile ranks
over numeric values extracted from the aggregated documents. These values
can be extracted either from specific numeric fields in the documents, or
be generated by a provided script.
Experimental!
This feature is marked as experimental, and may be subject to change in the future. If you use this feature, please let us know your experience with it!
Please see Percentiles are (usually) approximate and Compression for advice regarding approximation and memory use of the percentile ranks aggregation
Percentile rank show the percentage of observed values which are below certain value. For example, if a value is greater than or equal to 95% of the observed values it is said to be at the 95th percentile rank.
Assume your data consists of website load times. You may have a service agreement that 95% of page loads completely within 15ms and 99% of page loads complete within 30ms.
Let’s look at a range of percentiles representing load time:
{ "aggs" : { "load_time_outlier" : { "percentile_ranks" : { "field" : "load_time", "values" : [15, 30] } } } }
The response will look like this:
{ ... "aggregations": { "load_time_outlier": { "values" : { "15": 92, "30": 100 } } } }
From this information you can determine you are hitting the 99% load time target but not quite hitting the 95% load time target
Script
editThe percentile rank metric supports scripting. For example, if our load times are in milliseconds but we want to specify values in seconds, we could use a script to convert them on-the-fly: