﻿---
title: ES|QL SET directive
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3026/reference/query-languages/esql/commands/set
products:
  - Elasticsearch
---

# ES|QL SET directive
<applies-to>
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Preview in 9.3
</applies-to>

The `SET` directive can be used to specify query settings that modify the behavior of an ES|QL query.
**Syntax**
```esql
SET setting_name = setting_value[, ..., settingN = valueN]; <query>
```

Multiple SET directives can be included in a single query, separated by semicolons.
If the same setting is defined multiple times, the last definition takes precedence.
**Allowed settings**

### `time_zone`

<applies-to>
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Planned
</applies-to>

The default timezone to be used in the query. Defaults to UTC, and overrides the `time_zone` request parameter. See [timezones](/elastic/docs-builder/docs/3026/reference/query-languages/esql/esql-rest#esql-timezones).
**Type**: `keyword`

## Example

```esql
SET time_zone = "+05:00";
TS k8s
| WHERE @timestamp == "2024-05-10T00:04:49.000Z"
| STATS by @timestamp, bucket = TBUCKET(3 hours)
| SORT @timestamp
| LIMIT 2
```


### `unmapped_fields`

<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview since 9.3
</applies-to>

Defines how unmapped fields are treated. Possible values are:
- `DEFAULT` (default) - standard ESQL queries fail when referencing unmapped fields, while other query types (e.g. PromQL) may treat them differently;
- `NULLIFY` - treats unmapped fields as null values.
- `LOAD` - attempts to load the fields from the source. <applies-to>Elastic Stack: Planned</applies-to>

**Type**: `keyword`

## Example

Make the field null if it is unmapped.
```esql
SET unmapped_fields="nullify";
FROM employees
| KEEP emp_*, foo
| SORT emp_no
| LIMIT 1
```


| emp_no:integer | foo:null |
|----------------|----------|
| 10001          | null     |