Skip to content

Commit 224656e

Browse files
committed
updates
1 parent 9c92e58 commit 224656e

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

docs/reference/elasticsearch/index-settings/index-modules.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ Index mode supports the following values:
7272
`standard`
7373
: Standard indexing with default settings.
7474

75+
`lookup`
76+
: Index that can be used for lookup joins in ES|QL. Limited to 1 shard.
77+
78+
7579
`time_series`
7680
: *(data streams only)* Index mode optimized for storage of metrics. For more information, see [Time series index settings](time-series.md).
7781

docs/reference/query-languages/esql/esql-commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ mapped_pages:
66

77
# {{esql}} commands [esql-commands]
88

9-
109
## Source commands [esql-source-commands]
1110

1211
An {{esql}} source command produces a table, typically with data from {{es}}. An {{esql}} query must start with a source command.
@@ -685,21 +684,22 @@ TBD
685684

686685
**Examples**
687686

688-
TBD
687+
**IP Threat correlation**: This query would allow you to see if any source IPs match known malicious addresses.
689688

690689
```esql
691690
FROM firewall_logs
692691
| LOOKUP JOIN threat_list ON source.IP
693692
```
694693

694+
**Host metadata correctlation**: This query pulls in environment or ownership details for each host to correlate your metrics data.
695695

696696
```esql
697697
FROM system_metrics
698698
| LOOKUP JOIN host_inventory ON host.name
699699
| LOOKUP JOIN employees ON host.name
700700
```
701701

702-
TBD
702+
**Service ownership mapping**: This query would show logs with the owning team or escalation information for faster triage and incident response.
703703

704704
```esql
705705
FROM app_logs

docs/reference/query-languages/esql/esql-enrich-data.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ For example, you can use `ENRICH` to:
1515
* Add product information to retail orders based on product IDs
1616
* Supplement contact information based on an email address
1717

18+
[`ENRICH`](/reference/query-languages/esql/esql-commands.md#esql-enrich) is similar to [`LOOKUP join`](/reference/query-languages/esql/esql-commands.md#esql-lookup-join) in the fact that they both help you join data together. You should use `ENRICH` when:
19+
20+
* Enrichment data doesn't changes frequently
21+
* You can accept index-time overhead
22+
* You are working with structured enrichment patterns
23+
* You can accept having multiple matches combined into multi-values
24+
* You can accept being limited to predefined match fields
1825

1926
### How the `ENRICH` command works [esql-how-enrich-works]
2027

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,63 @@
11
---
2-
navigation_title: "LOOKUP JOIN"
2+
navigation_title: "Correlate data with LOOKUP JOIN"
33
mapped_pages:
44
- https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-enrich-data.html
55
---
66

77
# LOOKUP JOIN [esql-lookup-join]
88

9-
The {{esql}} [`LOOKUP join`](/reference/query-languages/esql/esql-commands.md#esql-lookup-join) processing command combines, at query-time, data from one or more source indexes with field-value combinations found in an input table.
9+
The {{esql}} [`LOOKUP join`](/reference/query-languages/esql/esql-commands.md#esql-lookup-join) processing command combines, at query-time, data from one or more source indexes with field-value combinations found in an input table. Teams often have data scattered across multiple indices – like logs, IPs, user IDs, hosts, employees etc. Without a direct way to enrich or correlate each event with reference data, root-cause analysis, security checks, and operational insights become time-consuming.
1010

1111
For example, you can use `LOOKUP JOIN` to:
1212

13-
* Pull in environment or ownership details for each host to enrich your metrics data
13+
* Pull in environment or ownership details for each host to correlate your metrics data.
1414
* Quickly see if any source IPs match known malicious addresses.
1515
* Tag logs with the owning team or escalation info for faster triage and incident response.
1616

17+
[`LOOKUP join`](/reference/query-languages/esql/esql-commands.md#esql-lookup-join) is similar to [`ENRICH`](/reference/query-languages/esql/esql-commands.md#esql-enrich) in the fact that they both help you join data together. You should use `LOOKUP JOIN` when:
1718

18-
### How the `LOOKUP JOIN` command works [esql-how-lookup-join-works]
19+
* Enrichment data changes frequently
20+
* You want to avoid index time processing
21+
* Working with regular indices
22+
* Need to preserve distinct matches
23+
* Need to match on any field in a lookup index
24+
25+
## How the `LOOKUP JOIN` command works [esql-how-lookup-join-works]
1926

2027
The `LOOKUP JOIN` command adds new columns to a table, with data from {{es}} indices. It requires a few special components:
2128

2229
:::{image} ../../../images/esql-lookup-join.png
2330
:alt: esql lookup join
2431
:::
2532

33+
::::{tip}
34+
`LOOKUP JOIN` does not guarantee the output to be in any particular order. If a certain order is required, users should use a [`SORT`](/reference/query-languages/esql/esql-commands.md#esql-sort) somewhere after the `LOOKUP JOIN`.
35+
36+
::::
2637

2738
$$$esql-source-index$$$
2839

2940
Source index
3041
: An index which stores enrich data that the `LOOKUP` command can add to input tables. You can create and manage these indices just like a regular {{es}} index. You can use multiple source indices in an enrich policy. You also can use the same source index in multiple enrich policies.
3142

3243

33-
### Prerequisites [esql-enrich-prereqs]
44+
## Prerequisites [esql-enrich-prereqs]
3445

3546
To use `LOOKUP JOIN`, you must have:
3647

3748
* Data types of join key and join field in the lookup index need to generally be the same - up to widening of data types, where e.g. `short,byte` are considered equal to `integer`. Also, text fields can be used on the left hand side if and only if there is an exact subfield whose name is suffixed with `.keyword`.
3849

50+
## Limitations
51+
52+
The following is a list of current limitations with `LOOKUP JOIN`
53+
54+
* `LOOKUP JOIN` will be sucessfull if both left and right type of the join are both `KEYWORD` types or if the left type is of `TEXT` and the right type is `KEYWORD`.
55+
* Indices in [lookup](elasticsearch/docs/reference/elasticsearch/index-settings/index-modules.md#index-mode-setting) mode are always single-sharded.
56+
* Cross cluster search is unsupported. Both source and lookup indicies must be local.
57+
* `LOOKUP JOIN` can only use a single match field, and can only use a single index. Wildcards, aliases, and datastreams are not supported.
58+
* The name of the match field in `LOOKUP JOIN lu_idx ON match_field` must match an existing field in the query. This may require renames or evals to achieve it.
59+
* The query will circuit break if you fetch too much data in a single page. A large heap is needed to manage results of multiple megabytes.
60+
* This limit is per page of data which is about about 10,000 rows.
61+
* Matching many rows per incoming row will count against this limit.
62+
* This limit is approximately the same as for [`ENRICH`](/reference/query-languages/esql/esql-commands.md#esql-enrich).
63+

0 commit comments

Comments
 (0)