median.asciidoc 664 B

123456789101112131415161718192021
  1. [[esql-agg-median]]
  2. === `MEDIAN`
  3. The value that is greater than half of all values and less than half of
  4. all values, also known as the 50% <<esql-agg-percentile>>.
  5. [source.merge.styled,esql]
  6. ----
  7. include::{esql-specs}/stats_percentile.csv-spec[tag=median]
  8. ----
  9. [%header.monospaced.styled,format=dsv,separator=|]
  10. |===
  11. include::{esql-specs}/stats_percentile.csv-spec[tag=median-result]
  12. |===
  13. NOTE: Like <<esql-agg-percentile>>, `MEDIAN` is <<esql-agg-percentile-approximate,usually approximate>>.
  14. [WARNING]
  15. ====
  16. `MEDIAN` is also {wikipedia}/Nondeterministic_algorithm[non-deterministic].
  17. This means you can get slightly different results using the same data.
  18. ====