﻿---
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://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_append)
  Appends two multi-value fields together.
- [`MV_DIFFERENCE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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>
  Returns values from first field not in second field.
- [`MV_DEDUPE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_dedupe)
  Removes duplicate values from a multi-value field.
- [`MV_SORT`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_sort)
  Sorts the values in a multi-value field.
- [`MV_INTERSECTION`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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>
  Returns values present in both multi-value fields.
- [`MV_UNION`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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>
  Returns all unique values from the combined multi-value fields.
- [`MV_SLICE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_slice)
  Returns a subset of a multi-value field using start and end indexes.


## Transformation functions

Functions that map a multi-value to a new multi-value.
- [`MV_ZIP`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_zip)
  Combines values from two multi-value fields with 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.
- [`MV_CONTAINS`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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>
  Checks if one multi-value field contains all values from another.
- [`MV_INTERSECTS`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/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>
  Checks if any value from one multi-value exists in another.

<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>


## Reduction functions

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

### General functions

- [`MV_COUNT`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_count)
  Counts the values in a multi-value field.


### Selection functions

Functions that reduce a multi-value to a single value by keeping one of the existing values.
- [`MV_FIRST`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_first)
  Returns the first value from a multi-value field.
- [`MV_LAST`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_last)
  Returns the last value from a multi-value field.
- [`MV_MIN`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_min)
  Returns the smallest value from a multi-value field.
- [`MV_MAX`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_max)
  Returns the largest value from a multi-value field.


### 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://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_avg)
  Averages the values in a multi-value field.
- [`MV_SUM`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_sum)
  Calculates the sum of all values in a multi-value field.
- [`MV_MEDIAN`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_median)
  Calculates the median of all values in a multi-value field.
- [`MV_MEDIAN_ABSOLUTE_DEVIATION`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_median_absolute_deviation)
  Calculates the median absolute deviation of a multi-value field.
- [`MV_PERCENTILE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_percentile)
  Calculates the percentile of all values in a multi-value field.
- [`MV_PSERIES_WEIGHTED_SUM`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_pseries_weighted_sum)
  Calculates the P-series weighted sum of a multi-value field.


#### String aggregation functions

Functions that calculate a single value from a string multi-value. (text, keyword)
- [`MV_CONCAT`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/mv-functions/mv_concat)
  Concatenates multi-value strings with a delimiter.