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
If you're familiar with SQL, `LOOKUP JOIN` has left-join behavior. This means that
82
+
if no rows match in the lookup index, the incoming row is retained and `null`s are added. If many rows in the lookup index match, `LOOKUP JOIN` adds one row per match.
83
+
61
84
[discrete]
62
85
[[esql-lookup-join-example]]
63
86
==== Example
64
87
65
-
`LOOKUP JOIN` has left-join behavior. If no rows match in the lookup index, `LOOKUP JOIN` retains the incoming row and adds nulls. If many rows in the lookup index match, `LOOKUP JOIN` adds one row per match.
88
+
You can run this example for yourself to see how it works by setting up the indices and adding sample data. Otherwise, you just inspect the query and response.
Next, let's add some sample data to both indices. The `threat_list` index contains known malicious IPs, while the `firewall_logs` index contains logs of network traffic.
`LOOKUP JOIN` does not guarantee the output to be in
136
-
any particular order. If a certain order is required, users should use a
137
-
<<esql-sort,`SORT`>> somewhere after the `LOOKUP JOIN`.
138
-
====
201
+
In this example, you can see that the `source.ip` field from the `firewall_logs` index is matched with the `source.ip` field in the `threat_list` index, and the corresponding `threat_level` and `threat_type` fields are added to the output.
202
+
203
+
[discrete]
204
+
[[esql-lookup-join-additional-examples]]
205
+
===== Additional examples
206
+
207
+
Refer to the examples section of the <<esql-lookup-join,LOOKUP JOIN>> command reference for more examples.
139
208
140
209
[discrete]
141
210
[[esql-lookup-join-prereqs]]
@@ -182,4 +251,4 @@ in the lookup index, or if the documents are too large. More precisely,
182
251
`LOOKUP JOIN` works in batches of, normally, about 10,000 rows; a large
183
252
amount of heap space is needed if the matching documents from the lookup
184
253
index for a batch are multiple megabytes or larger. This is roughly the
Copy file name to clipboardExpand all lines: docs/reference/esql/processing-commands/lookup.asciidoc
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,13 @@ changed or removed in a future release. Elastic will work to fix any
9
9
issues, but features in technical preview are not subject to the support
10
10
SLA of official GA features.
11
11
====
12
+
12
13
`LOOKUP JOIN` enables you to add data from another index, AKA a 'lookup'
13
14
index, to your {esql} query results, simplifying data enrichment
14
15
and analysis workflows.
15
16
17
+
See <<esql-lookup-join-landing-page,the high-level landing page>> for an overview of the `LOOKUP JOIN` command, including use cases, prerequisites, and current limitations.
18
+
16
19
*Syntax*
17
20
18
21
[source,esql]
@@ -24,8 +27,7 @@ FROM <source_index>
24
27
*Parameters*
25
28
26
29
`lookup_index`::
27
-
The name of the lookup index. This must be a specific index name - wildcards, aliases, and remote cluster
28
-
references are not supported.
30
+
The name of the lookup index. This must be a specific index name - wildcards, aliases, and remote cluster references are not supported. Indices used for lookups must be configured with the `lookup` <<index-mode-setting,index mode setting>>.
0 commit comments