## MV_SORT

The `MV_SORT` function is used to sort a multivalued field in lexicographical order.

### Syntax

`MV_SORT(field, order)`

#### Parameters

- `field`: A multivalue expression. If null, the function returns null.
- `order`: Sort order. The valid options are `ASC` and `DESC`, the default is `ASC`.

### Examples

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

```esql
ROW a = [4, 2, -3, 2]
| EVAL sa = MV_SORT(a)
```

In this example, the `MV_SORT` function is used to sort the values in the `a` field in ascending order.

```esql
ROW a = [4, 2, -3, 2]
| EVAL sd = MV_SORT(a, "DESC")
```

In this example, the `MV_SORT` function is used to sort the values in the `a` field in descending order.