You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/query-languages/esql/esql-commands.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -677,7 +677,11 @@ FROM firewall_logs
677
677
678
678
**Parameters**
679
679
680
-
TBD
680
+
`<lookup_index>`
681
+
: The name of the lookup index. This must be a specific index name - wildcards, aliases, and remote cluster references are not supported.
682
+
683
+
`<field_name>`
684
+
: The field to join on. This field must exist in both your current query results and in the lookup index. If the field contains multi-valued entries, those entries will not match anything (the added fields will contain `null` for those rows).
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 correlated information 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.
9
+
The {{esql}} [`LOOKUP JOIN`](/reference/query-languages/esql/esql-commands.md#esql-lookup-join) processing command combines data from your {esql} query results table with matching records from a specified lookup index. It adds fields from the lookup index as new columns to your results table based on matching values in the join field.
10
+
11
+
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.
10
12
11
13
For example, you can use `LOOKUP JOIN` to:
12
14
@@ -16,11 +18,11 @@ For example, you can use `LOOKUP JOIN` to:
16
18
17
19
[`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:
18
20
19
-
*Enrichment data changes frequently
20
-
* You want to avoid indextime processing
21
-
*Working with regular indices
22
-
*Need to preserve distinct matches
23
-
*Need to match on any field in a lookup index
21
+
*Your enrichment data changes frequently
22
+
* You want to avoid index-time processing
23
+
*You're working with regular indices
24
+
*You need to preserve distinct matches
25
+
*You need to match on any field in a lookup index
24
26
* You use document or field level security
25
27
26
28
## How the `LOOKUP JOIN` command works [esql-how-lookup-join-works]
@@ -40,7 +42,7 @@ Source index
40
42
41
43
In the case where there are multiple matches on the index `LOOKUP JOIN` the output rows is the combination of each match from the left with each match on the right.
42
44
43
-
Imagine you have the two tables:
45
+
In this example, we have two sample tables:
44
46
45
47
**Left**
46
48
@@ -84,7 +86,7 @@ FROM employees
84
86
85
87
::::
86
88
87
-
## Prerequisites [esql-enrich-prereqs]
89
+
## Prerequisites [esql-lookup-join-prereqs]
88
90
89
91
To use `LOOKUP JOIN`, you must have:
90
92
@@ -94,10 +96,10 @@ To use `LOOKUP JOIN`, you must have:
94
96
95
97
The following are the current limitations with `LOOKUP JOIN`
96
98
97
-
*`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`.
99
+
*`LOOKUP JOIN` will be successful if the join field in the lookup index is a `KEYWORD`type. If the main index's join field is `TEXT`type, it must have an exact `.keyword` subfield that can be matched with the lookup index's `KEYWORD` field.
98
100
* Indices in [lookup](/reference/elasticsearch/index-settings/index-modules.md#index-mode-setting) mode are always single-sharded.
99
101
* Cross cluster search is unsupported. Both source and lookup indices must be local.
100
-
*`LOOKUP JOIN` can only use a single match field, and can only use a single index. Wildcards, aliases, datemath, and datastreams are not supported.
102
+
*`LOOKUP JOIN` can only use a single match field and a single index. Wildcards, aliases, datemath, and datastreams are not supported.
101
103
* 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.
102
104
* The query will circuit break if many documents from the lookup index have the same key. A large heap is needed to manage results of multiple megabytes per key.
103
105
* This limit is per page of data which is about about 10,000 rows.
0 commit comments