## VALUES

The `VALUES` function in ES|QL is used to return all values in a group as a multivalued field. The order of the returned values isn’t guaranteed. If you need the values returned in order, you can use `MV_SORT`. This function can use a significant amount of memory and ES|QL doesn’t yet grow aggregations beyond memory. So this aggregation will work until it is used to collect more values than can fit into memory. Once it collects too many values it will fail the query with a Circuit Breaker Error.

### Syntax

`VALUES(expression)`

Where `expression` is an expression of any type except `geo_point`, `cartesian_point`, `geo_shape`, or `cartesian_shape`.

### Examples

Here are a couple of examples of how you can use the `VALUES` function in ES|QL queries:

```esql
FROM employees
| EVAL first_letter = SUBSTRING(first_name, 0, 1)
| STATS first_name = MV_SORT(VALUES(first_name)) BY first_letter
| SORT first_letter
```

In this example, the `VALUES` function is used to return all values of the `first_name` field in a group as a multivalued field. The `MV_SORT` function is then used to sort these values.

Please note that this function is in technical preview and may be changed or removed in a future release. It is not recommended to use `VALUES` on production environments.