greatest.asciidoc 706 B

123456789101112131415161718192021222324
  1. [[esql-greatest]]
  2. === `GREATEST`
  3. [.text-center]
  4. image::esql/functions/signature/greatest.svg[Embedded,opts=inline]
  5. Returns the maximum value from many columns. This is similar to <<esql-mv_max>>
  6. except it's intended to run on multiple columns at once.
  7. [source.merge.styled,esql]
  8. ----
  9. include::{esql-specs}/math.csv-spec[tag=greatest]
  10. ----
  11. [%header.monospaced.styled,format=dsv,separator=|]
  12. |===
  13. include::{esql-specs}/math.csv-spec[tag=greatest-result]
  14. |===
  15. NOTE: When run on `keyword` or `text` fields, this'll return the last string
  16. in alphabetical order. When run on `boolean` columns this will return
  17. `true` if any values are `true`.
  18. Supported types:
  19. include::types/greatest.asciidoc[]