percentile.asciidoc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [discrete]
  2. [[esql-agg-percentile]]
  3. === `PERCENTILE`
  4. *Syntax*
  5. [source,esql]
  6. ----
  7. PERCENTILE(column, percentile)
  8. ----
  9. *Parameters*
  10. `column`::
  11. Column to convert from multiple values to single value.
  12. `percentile`::
  13. A constant numeric expression.
  14. *Description*
  15. Returns the value at which a certain percentage of observed values occur. For
  16. example, the 95th percentile is the value which is greater than 95% of the
  17. observed values and the 50th percentile is the <<esql-agg-median>>.
  18. [discrete]
  19. [[esql-agg-percentile-approximate]]
  20. ==== `PERCENTILE` is (usually) approximate
  21. include::../../aggregations/metrics/percentile-aggregation.asciidoc[tag=approximate]
  22. [WARNING]
  23. ====
  24. `PERCENTILE` is also {wikipedia}/Nondeterministic_algorithm[non-deterministic].
  25. This means you can get slightly different results using the same data.
  26. ====
  27. *Example*
  28. [source.merge.styled,esql]
  29. ----
  30. include::{esql-specs}/stats_percentile.csv-spec[tag=percentile]
  31. ----
  32. [%header.monospaced.styled,format=dsv,separator=|]
  33. |===
  34. include::{esql-specs}/stats_percentile.csv-spec[tag=percentile-result]
  35. |===