ES|QL multivalue functions
ES|QL fields can contain more than one value. Multivalue functions let you manipulate, filter, and reduce those values within a query without needing to normalize the data first.
ES|QL supports these multivalue functions, grouped by category:
Functions to add, remove, combine, or reorder multi-value inputs. All these functions return multi-values.
-
Appends two multi-value fields together.
-
Returns values from first field not in second field.
-
Removes duplicate values from a multi-value field.
-
Sorts the values in a multi-value field.
-
Returns values present in both multi-value fields.
-
Returns all unique values from the combined multi-value fields.
-
Returns a subset of a multi-value field using start and end indexes.
Functions that map a multi-value to a new multi-value.
MV_ZIPCombines values from two multi-value fields with a delimiter.
Functions that return a boolean value based on the properties of a multi-value. These provide optimized shorthand expressions for common operations.
MV_CONTAINSChecks if one multi-value field contains all values from another.
MV_INTERSECTSChecks if any value from one multi-value exists in another.
null is interpreted as an empty set. To reject "unknown" or absent values, check for null before calling the function.
WHERE field2 IS NOT null AND MV_CONTAINS(field1, field2)
Functions that reduce a multi-value to a single value.
MV_COUNTCounts the values in a multi-value field.
Functions that reduce a multi-value to a single value by keeping one of the existing values.
MV_FIRSTReturns the first value from a multi-value field.
MV_LASTReturns the last value from a multi-value field.
MV_MINReturns the smallest value from a multi-value field.
MV_MAXReturns the largest value from a multi-value field.
Functions that reduce a multi-value to a single value by aggregating the values.
Functions that calculate a single value from a numeric multi-value. (double, integer, long, etc.)
MV_AVGAverages the values in a multi-value field.
MV_SUMCalculates the sum of all values in a multi-value field.
MV_MEDIANCalculates the median of all values in a multi-value field.
MV_MEDIAN_ABSOLUTE_DEVIATIONCalculates the median absolute deviation of a multi-value field.
MV_PERCENTILECalculates the percentile of all values in a multi-value field.
MV_PSERIES_WEIGHTED_SUMCalculates the P-series weighted sum of a multi-value field.
Functions that calculate a single value from a string multi-value. (text, keyword)
MV_CONCATConcatenates multi-value strings with a delimiter.