---
title: ES|QL MV_EXPAND command
description: 
url: https://www.elastic.co/docs/reference/query-languages/esql/commands/mv_expand
products:
  - Elasticsearch
---

# ES|QL MV_EXPAND command
<applies-to>
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available since 9.4
  - Elastic Stack: Preview from 9.0 to 9.3
</applies-to>

The `MV_EXPAND` processing command expands multivalued columns into one row per
value, duplicating other columns.

## Syntax

```esql
MV_EXPAND column
```


## Parameters

<definitions>
  <definition term="column">
    The multivalued column to expand.
  </definition>
</definitions>

<warning>
  `MV_EXPAND` does not preserve the sort order from a preceding `SORT`. The output
  rows can be in any order. To guarantee a certain ordering, place a `SORT` after
  `MV_EXPAND`.Additionally, if a `WHERE` clause follows `MV_EXPAND`, it may prevent the query
  planner from merging a preceding `SORT` with a trailing `LIMIT` into an
  efficient `TopN` operation. In such cases, the query will fail with a
  validation exception: `MV_EXPAND [MV_EXPAND field] cannot yet have an unbounded SORT [SORT field] before it: either move the SORT after it, or add a LIMIT after the SORT`.
  To work around this, add a `LIMIT` before `MV_EXPAND`:
  ```esql
  FROM index | SORT field | LIMIT 1000 | MV_EXPAND mv_field | WHERE mv_field == "value"
  ```
</warning>


## Example

```esql
ROW a=[1,2,3], b="b", j=["a","b"]
| MV_EXPAND a
```


| a:integer | b:keyword | j:keyword  |
|-----------|-----------|------------|
| 1         | b         | ["a", "b"] |
| 2         | b         | ["a", "b"] |
| 3         | b         | ["a", "b"] |