mv_max.asciidoc 686 B

123456789101112131415161718192021222324
  1. [[esql-mv_max]]
  2. === `MV_MAX`
  3. Converts a multivalued field into a single valued field containing the maximum value. For example:
  4. [source.merge.styled,esql]
  5. ----
  6. include::{esql-specs}/math.csv-spec[tag=mv_max]
  7. ----
  8. [%header.monospaced.styled,format=dsv,separator=|]
  9. |===
  10. include::{esql-specs}/math.csv-spec[tag=mv_max-result]
  11. |===
  12. It can be used by any field type, including `keyword` fields. In that case picks the
  13. last string, comparing their utf-8 representation byte by byte:
  14. [source.merge.styled,esql]
  15. ----
  16. include::{esql-specs}/string.csv-spec[tag=mv_max]
  17. ----
  18. [%header.monospaced.styled,format=dsv,separator=|]
  19. |===
  20. include::{esql-specs}/string.csv-spec[tag=mv_max-result]
  21. |===