﻿---
title: ES|QL MV_DEDUPE function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3729/reference/query-languages/esql/functions-operators/mv-functions/mv_dedupe
products:
  - Elasticsearch
---

# ES|QL MV_DEDUPE function
<applies-to>
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
</applies-to>

Removes duplicate values from a multi-value field.

## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3729/reference/query-languages/esql/images/generated/x-pack-esql/functions/mv_dedupe.svg)


## Parameters

<definitions>
  <definition term="field">
    Expression that can be null, a single value, or multiple values.
  </definition>
</definitions>


## Description

Remove duplicate values from a multivalued field.
<note>
  `MV_DEDUPE` may, but won’t always, sort the values in the column.
</note>


## Supported types


| field                                                               | result          |
|---------------------------------------------------------------------|-----------------|
| boolean                                                             | boolean         |
| cartesian_point                                                     | cartesian_point |
| cartesian_shape                                                     | cartesian_shape |
| date                                                                | date            |
| date_nanos                                                          | date_nanos      |
| double                                                              | double          |
| flattened <applies-to>Elastic Stack: Preview since 9.5</applies-to> | flattened       |
| geo_point                                                           | geo_point       |
| geo_shape                                                           | geo_shape       |
| geohash                                                             | geohash         |
| geohex                                                              | geohex          |
| geotile                                                             | geotile         |
| integer                                                             | integer         |
| ip                                                                  | ip              |
| keyword                                                             | keyword         |
| long                                                                | long            |
| text                                                                | keyword         |
| unsigned_long                                                       | unsigned_long   |
| version                                                             | version         |


## Example

```esql
ROW a=["foo", "foo", "bar", "foo"]
| EVAL dedupe_a = MV_DEDUPE(a)
```


| a:keyword                    | dedupe_a:keyword |
|------------------------------|------------------|
| ["foo", "foo", "bar", "foo"] | ["foo", "bar"]   |