123456789101112131415161718192021222324252627 |
- [discrete]
- [[esql-mv_first]]
- === `MV_FIRST`
- [.text-center]
- image::esql/functions/signature/mv_first.svg[Embedded,opts=inline]
- Converts a multivalued field into a single valued field containing the first value. This is most
- useful when reading from a function that emits multivalued fields in a known order like <<esql-split>>:
- [source.merge.styled,esql]
- ----
- include::{esql-specs}/string.csv-spec[tag=mv_first]
- ----
- [%header.monospaced.styled,format=dsv,separator=|]
- |===
- include::{esql-specs}/string.csv-spec[tag=mv_first-result]
- |===
- The order that <<esql-multivalued-fields, multivalued fields>> are read from underlying storage is not
- guaranteed. It is *frequently* ascending, but don't rely on that. If you need the minimum field value
- use <<esql-mv_min>> instead of `MV_FIRST`. `MV_MIN` has optimizations for sorted values so there isn't
- a performance benefit to `MV_FIRST`. `MV_FIRST` is mostly useful with functions that create multivalued
- fields like `SPLIT`.
- Supported types:
- include::types/mv_first.asciidoc[]
|