## KEEP

The `KEEP` command in ES|QL allows you to specify which columns are returned and the order in which they are returned. This can be particularly useful when you want to focus on specific data in your Elasticsearch indices and ignore the rest.

The command supports wildcards, allowing you to match and return all columns with a name that fits a certain pattern. Precedence rules are applied when a field name matches multiple expressions. If a field matches two expressions with the same precedence, the right-most expression wins.

### Limitations

There are no known limitations for the `KEEP` command in ES|QL.

### Examples

Here are some examples of how you can use the `KEEP` command in ES|QL:

1. Return specified columns in the order they are listed:

```esql
FROM employees
| KEEP emp_no, first_name, last_name, height
```

2. Use wildcards to return all columns with a name that matches a pattern:

```esql
FROM employees
| KEEP h*
```

3. Use the asterisk wildcard by itself to return all columns that do not match the other arguments:

```esql
FROM employees
| KEEP h*, *
```

4. Show how precedence rules work when a field name matches multiple expressions:

```esql
FROM employees
| KEEP first_name*, last_name, first_na*
```

5. Use a simple wildcard expression `*` which has the lowest precedence:

```esql
FROM employees
| KEEP *, first_name
```