﻿---
title: ES|QL multivalue functions
description: ES|QL fields can contain more than one value. Multivalue functions let you manipulate, filter, and reduce those values within a query without needing...
url: https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions
products:
  - Elasticsearch
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# 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:
- [Manipulation functions](#manipulation-functions)
- [Transformation functions](#transformation-functions)
- [Filter and predicate functions](#filter-and-predicate-functions)
- [Reduction functions](#reduction-functions)


## Manipulation functions

Functions to add, remove, combine, or reorder multi-value inputs. All these functions
return multi-values.
- [`MV_APPEND`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_append): Adds a value or multi-value to the end of a multi-value.
- [`MV_DIFFERENCE`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_difference) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>: Removes a value or multi-value from a multi-value.
- [`MV_DEDUPE`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_dedupe): Removes duplicate values from a multi-value.
- [`MV_SORT`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_sort): Sorts the values in a multi-value.
- [`MV_INTERSECTION`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_intersection) <applies-to>Elastic Stack: Preview since 9.3</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>: Keeps the values present in both multi-values.
- [`MV_UNION`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_union) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>: Keeps all the unique values present in either multi-value.
- [`MV_SLICE`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_slice): Keeps the values in a multi-value between the given start and end indexes.


## Transformation functions

Functions that map a multi-value to a new multi-value.
- [`MV_ZIP`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_zip): Combines values from two multi-values at each position using a delimiter.


## Filter and predicate functions

Functions that return a boolean value based on the properties of a multi-value.
These provide optimized shorthand expressions for common operations.
<note>
  `null` is interpreted as an empty set. To reject "unknown" or absent values, check for `null` before calling the function.
  ```esql
  WHERE field2 IS NOT null AND MV_CONTAINS(field1, field2)
  ```
</note>

- [`MV_CONTAINS`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_contains) <applies-to>Elastic Stack: Preview since 9.2</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>: Tests if a multi-value contains _all_ of the provided values.
- [`MV_INTERSECTS`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_intersects) <applies-to>Elastic Stack: Preview since 9.3</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>: Tests if a multi-value contains _any_ of the provided values.


## Reduction functions

Functions that reduce a multi-value to a single value.

### General functions

- [`MV_COUNT`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_count): Counts the number of values in a multi-value.


### Selection functions

Functions that reduce a multi-value to a single value by keeping one of the existing values.
- [`MV_FIRST`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_first): returns the first value in a multi-value.
- [`MV_LAST`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_last): returns the last value in a multi-value.
- [`MV_MIN`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_min): returns the smallest value in a multi-value.
- [`MV_MAX`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_max): returns the largest value in a multi-value.


### Aggregation functions

Functions that reduce a multi-value to a single value by aggregating the values.

#### Numeric aggregation functions

Functions that calculate a single value from a numeric multi-value.
(double, integer, long, etc.)
- [`MV_AVG`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_avg): calculates the average of all values in a multi-value.
- [`MV_SUM`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_sum): calculates the sum of all values in a multi-value.
- [`MV_MEDIAN`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_median): calculates the median of all values in a multi-value.
- [`MV_MEDIAN_ABSOLUTE_DEVIATION`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_median_absolute_deviation): calculates the median absolute deviation of all values in a multi-value.
- [`MV_PERCENTILE`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_percentile): calculates the percentile of all values in a multi-value.
- [`MV_PSERIES_WEIGHTED_SUM`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_pseries_weighted_sum): calculates the weighted sum of all values in a multi-value.


#### String aggregation functions

Functions that calculate a single value from a string multi-value. (text, keyword)
- [`MV_CONCAT`](https://www.elastic.co/elastic/docs-builder/docs/3466/reference/query-languages/esql/functions-operators/mv-functions/mv_concat): concatenates all values into a single string.