Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
503f943
Split ES|QL functions/operators into separate pages for similar funct…
craigtaverner Apr 4, 2025
ef77664
Merge branch 'main' into esql_split_docs_pages_functions_operators
craigtaverner Apr 4, 2025
030dfc2
Restructure operators to be more like functions
craigtaverner Apr 4, 2025
e6a7913
Fix some broken links
craigtaverner Apr 4, 2025
5a56eb8
Add three missing SVG files for operators
craigtaverner Apr 4, 2025
44e31ac
Fix incorrect example for match operator
craigtaverner Apr 4, 2025
0f3eb18
Split commands into multiple pages
craigtaverner Apr 4, 2025
8d6fb00
Do not delete the static commands files
craigtaverner Apr 4, 2025
62947a0
Merge remote-tracking branch 'origin/main' into esql_split_docs_pages…
craigtaverner Apr 5, 2025
6bac25c
Merge branch 'main' into esql_split_docs_pages_functions_operators
craigtaverner Apr 7, 2025
503313f
Extract examples from ES|QL commands into separate files
craigtaverner Apr 9, 2025
d08fd97
Generate commands examples for the first time
craigtaverner Apr 9, 2025
fe3160d
Kibana docs updates, better operator name/title and symbols
craigtaverner Apr 9, 2025
a17b959
Merge branch 'esql_split_docs_pages_functions_operators' of github.co…
craigtaverner Apr 9, 2025
7b512cc
Update docs/reference/query-languages/esql/functions-operators/aggreg…
craigtaverner Apr 9, 2025
c8b9411
Update docs/reference/query-languages/esql/functions-operators/condit…
craigtaverner Apr 9, 2025
f05d92e
Update docs/reference/query-languages/esql/functions-operators/condit…
craigtaverner Apr 9, 2025
8774077
Update docs/reference/query-languages/esql/functions-operators/date-t…
craigtaverner Apr 9, 2025
2d2a3ae
Update docs/reference/query-languages/esql/functions-operators/search…
craigtaverner Apr 9, 2025
28f3048
Update docs/reference/query-languages/esql/functions-operators/date-t…
craigtaverner Apr 9, 2025
447c2d9
Update docs/reference/query-languages/esql/functions-operators/search…
craigtaverner Apr 9, 2025
4ac5512
Update docs/reference/query-languages/esql/functions-operators/string…
craigtaverner Apr 9, 2025
b41ea7f
Update docs/reference/query-languages/esql/functions-operators/type-c…
craigtaverner Apr 9, 2025
ee30d35
Added redirects.yml from Liam
craigtaverner Apr 9, 2025
7fc19af
Merge branch 'esql_split_docs_pages_functions_operators' of github.co…
craigtaverner Apr 9, 2025
d47514a
Merge remote-tracking branch 'origin/main' into esql_split_docs_pages…
craigtaverner Apr 9, 2025
4d23620
Bring back rename edits after merging main
craigtaverner Apr 9, 2025
806f7ef
redirects: attempt 1 of n
leemthompo Apr 10, 2025
67f70c8
redirects: attempt 2 of n, bulk approach
leemthompo Apr 10, 2025
6e9dda7
redirects: attempt 3 of n, wrong path?
leemthompo Apr 10, 2025
567d1f7
redirects: attempt 4 of n, inconsistent paths?
leemthompo Apr 10, 2025
ccc6aa8
redirects: attempt 5 of n (file in wrong dir?)
leemthompo Apr 10, 2025
c349f28
Update docs/reference/query-languages/esql/functions-operators/spatia…
craigtaverner Apr 10, 2025
95dbf05
Merge branch 'main' into esql_split_docs_pages_functions_operators
craigtaverner Apr 10, 2025
478d73d
Update docs/reference/query-languages/esql/functions-operators/groupi…
craigtaverner Apr 10, 2025
611f00c
Update docs/reference/query-languages/esql/functions-operators/ip-fun…
craigtaverner Apr 10, 2025
bc0c711
Update docs/reference/query-languages/esql/functions-operators/math-f…
craigtaverner Apr 10, 2025
acbcb2c
Update docs/reference/query-languages/esql/functions-operators/math-f…
craigtaverner Apr 10, 2025
2fb4609
Update docs/reference/query-languages/esql/functions-operators/mv-fun…
craigtaverner Apr 10, 2025
bed3693
Update docs/reference/query-languages/esql/functions-operators/operat…
craigtaverner Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## `DISSECT` [esql-dissect]

`DISSECT` enables you to [extract structured data out of a string](/reference/query-languages/esql/esql-process-data-with-dissect-grok.md).

**Syntax**

```esql
DISSECT input "pattern" [APPEND_SEPARATOR="<separator>"]
```

**Parameters**

`input`
: The column that contains the string you want to structure. If the column has multiple values, `DISSECT` will process each value.

`pattern`
: A [dissect pattern](/reference/query-languages/esql/esql-process-data-with-dissect-grok.md#esql-dissect-patterns). If a field name conflicts with an existing column, the existing column is dropped. If a field name is used more than once, only the rightmost duplicate creates a column.

`<separator>`
: A string used as the separator between appended values, when using the [append modifier](/reference/query-languages/esql/esql-process-data-with-dissect-grok.md#esql-append-modifier).

**Description**

`DISSECT` enables you to [extract structured data out of a string](/reference/query-languages/esql/esql-process-data-with-dissect-grok.md). `DISSECT` matches the string against a delimiter-based pattern, and extracts the specified keys as columns.

Refer to [Process data with `DISSECT`](/reference/query-languages/esql/esql-process-data-with-dissect-grok.md#esql-process-data-with-dissect) for the syntax of dissect patterns.

**Examples**

The following example parses a string that contains a timestamp, some text, and an IP address:

```esql
ROW a = "2023-01-23T12:15:00.000Z - some text - 127.0.0.1"
| DISSECT a """%{date} - %{msg} - %{ip}"""
| KEEP date, msg, ip
```

| date:keyword | msg:keyword | ip:keyword |
| --- | --- | --- |
| 2023-01-23T12:15:00.000Z | some text | 127.0.0.1 |

By default, `DISSECT` outputs keyword string columns. To convert to another type, use [Type conversion functions](/reference/query-languages/esql/functions-operators/type-conversion-functions.md):

```esql
ROW a = "2023-01-23T12:15:00.000Z - some text - 127.0.0.1"
| DISSECT a """%{date} - %{msg} - %{ip}"""
| KEEP date, msg, ip
| EVAL date = TO_DATETIME(date)
```

| msg:keyword | ip:keyword | date:date |
| --- | --- | --- |
| some text | 127.0.0.1 | 2023-01-23T12:15:00.000Z |


Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## `DROP` [esql-drop]

The `DROP` processing command removes one or more columns.

**Syntax**

```esql
DROP columns
```

**Parameters**

`columns`
: A comma-separated list of columns to remove. Supports wildcards.

**Examples**

```esql
FROM employees
| DROP height
```

Rather than specify each column by name, you can use wildcards to drop all columns with a name that matches a pattern:

```esql
FROM employees
| DROP height*
```


Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## `ENRICH` [esql-enrich]

`ENRICH` enables you to add data from existing indices as new columns using an enrich policy.

**Syntax**

```esql
ENRICH policy [ON match_field] [WITH [new_name1 = ]field1, [new_name2 = ]field2, ...]
```

**Parameters**

`policy`
: The name of the enrich policy. You need to [create](/reference/query-languages/esql/esql-enrich-data.md#esql-set-up-enrich-policy) and [execute](/reference/query-languages/esql/esql-enrich-data.md#esql-execute-enrich-policy) the enrich policy first.

`mode`
: The mode of the enrich command in cross cluster {{esql}}. See [enrich across clusters](docs-content://explore-analyze/query-filter/languages/esql-cross-clusters.md#ccq-enrich).

`match_field`
: The match field. `ENRICH` uses its value to look for records in the enrich index. If not specified, the match will be performed on the column with the same name as the `match_field` defined in the [enrich policy](/reference/query-languages/esql/esql-enrich-data.md#esql-enrich-policy).

`fieldX`
: The enrich fields from the enrich index that are added to the result as new columns. If a column with the same name as the enrich field already exists, the existing column will be replaced by the new column. If not specified, each of the enrich fields defined in the policy is added. A column with the same name as the enrich field will be dropped unless the enrich field is renamed.

`new_nameX`
: Enables you to change the name of the column that’s added for each of the enrich fields. Defaults to the enrich field name. If a column has the same name as the new name, it will be discarded. If a name (new or original) occurs more than once, only the rightmost duplicate creates a new column.

**Description**

`ENRICH` enables you to add data from existing indices as new columns using an enrich policy. Refer to [Data enrichment](/reference/query-languages/esql/esql-enrich-data.md) for information about setting up a policy.

:::{image} /reference/query-languages/images/esql-enrich.png
:alt: esql enrich
:::

::::{tip}
Before you can use `ENRICH`, you need to [create and execute an enrich policy](/reference/query-languages/esql/esql-enrich-data.md#esql-set-up-enrich-policy).
::::


**Examples**

The following example uses the `languages_policy` enrich policy to add a new column for each enrich field defined in the policy. The match is performed using the `match_field` defined in the [enrich policy](/reference/query-languages/esql/esql-enrich-data.md#esql-enrich-policy) and requires that the input table has a column with the same name (`language_code` in this example). `ENRICH` will look for records in the [enrich index](/reference/query-languages/esql/esql-enrich-data.md#esql-enrich-index) based on the match field value.

```esql
ROW language_code = "1"
| ENRICH languages_policy
```

| language_code:keyword | language_name:keyword |
| --- | --- |
| 1 | English |

To use a column with a different name than the `match_field` defined in the policy as the match field, use `ON <column-name>`:

```esql
ROW a = "1"
| ENRICH languages_policy ON a
```

| a:keyword | language_name:keyword |
| --- | --- |
| 1 | English |

By default, each of the enrich fields defined in the policy is added as a column. To explicitly select the enrich fields that are added, use `WITH <field1>, <field2>, ...`:

```esql
ROW a = "1"
| ENRICH languages_policy ON a WITH language_name
```

| a:keyword | language_name:keyword |
| --- | --- |
| 1 | English |

You can rename the columns that are added using `WITH new_name=<field1>`:

```esql
ROW a = "1"
| ENRICH languages_policy ON a WITH name = language_name
```

| a:keyword | name:keyword |
| --- | --- |
| 1 | English |

In case of name collisions, the newly created columns will override existing columns.


Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## `EVAL` [esql-eval]

The `EVAL` processing command enables you to append new columns with calculated values.

**Syntax**

```esql
EVAL [column1 =] value1[, ..., [columnN =] valueN]
```

**Parameters**

`columnX`
: The column name. If a column with the same name already exists, the existing column is dropped. If a column name is used more than once, only the rightmost duplicate creates a column.

`valueX`
: The value for the column. Can be a literal, an expression, or a [function](/reference/query-languages/esql/esql-functions-operators.md#esql-functions). Can use columns defined left of this one.

**Description**

The `EVAL` processing command enables you to append new columns with calculated values. `EVAL` supports various functions for calculating values. Refer to [Functions](/reference/query-languages/esql/esql-functions-operators.md#esql-functions) for more information.

**Examples**

```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height_feet = height * 3.281, height_cm = height * 100
```

| first_name:keyword | last_name:keyword | height:double | height_feet:double | height_cm:double |
| --- | --- | --- | --- | --- |
| Georgi | Facello | 2.03 | 6.66043 | 202.99999999999997 |
| Bezalel | Simmel | 2.08 | 6.82448 | 208.0 |
| Parto | Bamford | 1.83 | 6.004230000000001 | 183.0 |

If the specified column already exists, the existing column will be dropped, and the new column will be appended to the table:

```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height = height * 3.281
```

| first_name:keyword | last_name:keyword | height:double |
| --- | --- | --- |
| Georgi | Facello | 6.66043 |
| Bezalel | Simmel | 6.82448 |
| Parto | Bamford | 6.004230000000001 |

Specifying the output column name is optional. If not specified, the new column name is equal to the expression. The following query adds a column named `height*3.281`:

```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height * 3.281
```

| first_name:keyword | last_name:keyword | height:double | height * 3.281:double |
| --- | --- | --- | --- |
| Georgi | Facello | 2.03 | 6.66043 |
| Bezalel | Simmel | 2.08 | 6.82448 |
| Parto | Bamford | 1.83 | 6.004230000000001 |

Because this name contains special characters, [it needs to be quoted](/reference/query-languages/esql/esql-syntax.md#esql-identifiers) with backticks (```) when using it in subsequent commands:

```esql
FROM employees
| EVAL height * 3.281
| STATS avg_height_feet = AVG(`height * 3.281`)
```

| avg_height_feet:double |
| --- |
| 5.801464200000001 |


Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## `FROM` [esql-from]

The `FROM` source command returns a table with data from a data stream, index, or alias.

**Syntax**

```esql
FROM index_pattern [METADATA fields]
```

**Parameters**

`index_pattern`
: A list of indices, data streams or aliases. Supports wildcards and date math.

`fields`
: A comma-separated list of [metadata fields](/reference/query-languages/esql/esql-metadata-fields.md) to retrieve.

**Description**

The `FROM` source command returns a table with data from a data stream, index, or alias. Each row in the resulting table represents a document. Each column corresponds to a field, and can be accessed by the name of that field.

::::{note}
By default, an {{esql}} query without an explicit [`LIMIT`](#esql-limit) uses an implicit limit of 1000. This applies to `FROM` too. A `FROM` command without `LIMIT`:

```esql
FROM employees
```

is executed as:

```esql
FROM employees
| LIMIT 1000
```

::::


**Examples**

```esql
FROM employees
```

You can use [date math](/reference/elasticsearch/rest-apis/api-conventions.md#api-date-math-index-names) to refer to indices, aliases and data streams. This can be useful for time series data, for example to access today’s index:

```esql
FROM <logs-{now/d}>
```

Use comma-separated lists or wildcards to [query multiple data streams, indices, or aliases](docs-content://explore-analyze/query-filter/languages/esql-multi-index.md):

```esql
FROM employees-00001,other-employees-*
```

Use the format `<remote_cluster_name>:<target>` to [query data streams and indices on remote clusters](docs-content://explore-analyze/query-filter/languages/esql-cross-clusters.md):

```esql
FROM cluster_one:employees-00001,cluster_two:other-employees-*
```

Use the optional `METADATA` directive to enable [metadata fields](/reference/query-languages/esql/esql-metadata-fields.md):

```esql
FROM employees METADATA _id
```

Use enclosing double quotes (`"`) or three enclosing double quotes (`"""`) to escape index names that contain special characters:

```esql
FROM "this=that", """this[that"""
```


Loading
Loading