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/_snippets/commands/layout/lookup-join.md
+6-14Lines changed: 6 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,28 +13,20 @@ Refer to [the high-level landing page](../../../../esql/esql-lookup-join.md) for
13
13
14
14
```esql
15
15
FROM <source_index>
16
-
| LOOKUP JOIN <lookup_index> ON <field_name>
17
-
```
18
-
19
-
```esql
20
-
FROM <source_index>
21
-
| LOOKUP JOIN <lookup_index> ON <field_name1>, <field_name2>, <field_name3>
22
-
```
23
-
```esql
24
-
FROM <source_index>
25
-
| LOOKUP JOIN <lookup_index> ON <left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2>
16
+
| LOOKUP JOIN <lookup_index> ON <join_condition>
26
17
```
27
18
28
19
**Parameters**
29
20
30
21
`<lookup_index>`
31
22
: 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](/reference/elasticsearch/index-settings/index-modules.md#index-mode-setting).
32
23
33
-
`<field_name>`or `<field_name1>, <field_name2>, <field_name3>` or `<left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2>`
34
-
: The join condition. Can be one of the following:
24
+
`<join_condition>`
25
+
: Can be one of the following:
35
26
* A single field name
36
-
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
37
-
* An expression with one or more join conditions linked by `AND`. Each condition compares a field from the left index with a field from the lookup index using [binary operators](/reference/query-languages/esql/functions-operators/operators.md#esql-binary-operators) (`==`, `>=`, `<=`, `>`, `<`, `!=`). Each field name in the join condition must exist in only one of the indexes. Use RENAME to resolve naming conflicts. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
27
+
* A comma-separated list of field names, for example `<field1>, <field2>, <field3>` {applies_to}`stack: ga 9.2`
28
+
* An expression with one or more predicates linked by `AND`, for example `<left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2>`. Each predicate compares a field from the left index with a field from the lookup index using [binary operators](/reference/query-languages/esql/functions-operators/operators.md#esql-binary-operators) (`==`, `>=`, `<=`, `>`, `<`, `!=`). Each field name in the join condition must exist in only one of the indexes. Use RENAME to resolve naming conflicts. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
29
+
* An expression that includes [full text functions](/reference/query-languages/esql/functions-operators/search-functions.md) and other Lucene-pushable functions, for example `MATCH(<lookup_field>, "search term") AND <left_field> == <lookup_field>`. These functions can be combined with binary operators and logical operators (`AND`, `OR`, `NOT`) to create complex join conditions. At least one condition that relates the lookup index fields to the left side of the join fields is still required. {applies_to}`stack: preview 9.3` {applies_to}`serverless: preview`
38
30
: If using join on a single field or a field list, the fields used must exist in both your current query results and in the lookup index. If the fields contains multi-valued entries, those entries will not match anything (the added fields will contain `null` for those rows).
Copy file name to clipboardExpand all lines: docs/reference/query-languages/esql/esql-lookup-join.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,10 @@ For example, you can use `LOOKUP JOIN` to:
31
31
* You want to restrict users to use only specific lookup indices
32
32
* You do not need to match using ranges or spatial relations
33
33
34
+
## Syntax reference
35
+
36
+
Refer to [`LOOKUP JOIN`](/reference/query-languages/esql/commands/lookup-join.md) for the detailed syntax reference.
37
+
34
38
## How the command works [esql-how-lookup-join-works]
35
39
36
40
The `LOOKUP JOIN` command adds fields from the lookup index as new columns to your results table based on matching values in the join field.
@@ -40,12 +44,14 @@ The command requires two parameters:
40
44
* The join condition. Can be one of the following:
41
45
* A single field name
42
46
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
43
-
* An expression with one or more join conditions linked by `AND`. Each condition compares a field from the left index with a field from the lookup index using [binary operators](/reference/query-languages/esql/functions-operators/operators.md#esql-binary-operators) (`==`, `>=`, `<=`, `>`, `<`, `!=`). Each field name in the join condition must exist in only one of the indexes. Use RENAME to resolve naming conflicts. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
47
+
* An expression with one or more join conditions linked by `AND`. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
48
+
* An expression that includes [Full Text Functions](/reference/query-languages/esql/functions-operators/search-functions.md) and other Lucene pushable functions applied to fields from the lookup index {applies_to}`stack: preview 9.3` {applies_to}`serverless: preview`
44
49
45
50
```esql
46
51
LOOKUP JOIN <lookup_index> ON <field_name> # Join on a single field
47
52
LOOKUP JOIN <lookup_index> ON <field_name1>, <field_name2>, <field_name3> # Join on multiple fields
48
53
LOOKUP JOIN <lookup_index> ON <left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2> # Join on expression
54
+
LOOKUP JOIN <lookup_index> ON MATCH(lookup_field, "search term") AND <left_field> == <lookup_field> # Join with Full Text Functions
0 commit comments