Skip to content

Commit df9f1f9

Browse files
Docs/ESQL: Add docs for Lookup Join with Full Text Functions support (#137064)
Add docs for Lookup Join with Full Text Functions support
1 parent 96ea61b commit df9f1f9

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

docs/reference/query-languages/esql/_snippets/commands/layout/lookup-join.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,20 @@ Refer to [the high-level landing page](../../../../esql/esql-lookup-join.md) for
1313

1414
```esql
1515
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>
2617
```
2718

2819
**Parameters**
2920

3021
`<lookup_index>`
3122
: 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).
3223

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:
3526
* 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`
3830
: 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).
3931

4032

docs/reference/query-languages/esql/esql-lookup-join.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ For example, you can use `LOOKUP JOIN` to:
3131
* You want to restrict users to use only specific lookup indices
3232
* You do not need to match using ranges or spatial relations
3333

34+
## Syntax reference
35+
36+
Refer to [`LOOKUP JOIN`](/reference/query-languages/esql/commands/lookup-join.md) for the detailed syntax reference.
37+
3438
## How the command works [esql-how-lookup-join-works]
3539

3640
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:
4044
* The join condition. Can be one of the following:
4145
* A single field name
4246
* 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`
4449

4550
```esql
4651
LOOKUP JOIN <lookup_index> ON <field_name> # Join on a single field
4752
LOOKUP JOIN <lookup_index> ON <field_name1>, <field_name2>, <field_name3> # Join on multiple fields
4853
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
4955
```
5056

5157
:::{image} ../images/esql-lookup-join.png

0 commit comments

Comments
 (0)