---
title: ES|QL MV_MAX function
description: 
url: https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/mv-functions/mv_max
products:
  - Elasticsearch
---

# ES|QL MV_MAX function
## Syntax

![Embedded](https://www.elastic.co/docs/reference/query-languages/esql/images/functions/mv_max.svg)


## Parameters

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


## Description

Converts a multivalued expression into a single valued column containing the maximum value.

## Supported types


| field         | result        |
|---------------|---------------|
| boolean       | boolean       |
| date          | date          |
| date_nanos    | date_nanos    |
| double        | double        |
| integer       | integer       |
| ip            | ip            |
| keyword       | keyword       |
| long          | long          |
| text          | keyword       |
| unsigned_long | unsigned_long |
| version       | version       |


## Examples

```esql
ROW a=[3, 5, 1]
| EVAL max_a = MV_MAX(a)
```


| a:integer | max_a:integer |
|-----------|---------------|
| [3, 5, 1] | 5             |

It can be used by any column type, including `keyword` columns. In that case it picks the last string, comparing their utf-8 representation byte by byte:
```esql
ROW a=["foo", "zoo", "bar"]
| EVAL max_a = MV_MAX(a)
```


| a:keyword             | max_a:keyword |
|-----------------------|---------------|
| ["foo", "zoo", "bar"] | "zoo"         |