elasticsearch/docs/reference/query-languages/esql/commands/lookup.disabled
Craig Taverner 67b15ad5d8
Split ES|QL functions/operators/commands into separate pages for similar functions and make commands examples generated (#126279)
While the internal structure of the docs is already split into many (over 1000) sub-pages, the final display for the `Functions and Operators` page is a single giant page, making navigation harder. This PR splits it into separate pages, one for each group of similar functions and one for the operators. Twelve new pages.

This PR also bundles a few other related changes. In total what is done is:
* Split functions/operators into 12 pages, one for each group, maintaining the existing split of each function/operator into a snippet with dynamically generated examples
* Split esql-commands.md into source-commands.md and processing-commands.md, each of which is split into individual snippets, one for each command
* Each command snippet has it's examples split out into separate files, if they were examples that were dynamically generated in the older asciidoc system
* The examples files are overwritten by the ES|QL unit tests, using a similar mechanism to the examples written for functions and operators)
* Some additional refinements to the Kibana definition and markdown files (nicer operator headings, and display text)
2025-04-10 15:56:05 +02:00

64 lines
1.6 KiB
Text

[discrete]
[[esql-lookup]]
=== `LOOKUP`
experimental::["LOOKUP is highly experimental and only available in SNAPSHOT versions."]
`LOOKUP` matches values from the input against a `table` provided in the request,
adding the other fields from the `table` to the output.
**Syntax**
[source,esql]
----
LOOKUP table ON match_field1[, match_field2, ...]
----
*Parameters*
`table`::
The name of the `table` provided in the request to match.
If the table's column names conflict with existing columns, the existing columns will be dropped.
`match_field`::
The fields in the input to match against the table.
*Examples*
// tag::examples[]
[source,console,id=esql-lookup-example]
----
POST /_query?format=txt
{
"query": """
FROM library
| SORT page_count DESC
| KEEP name, author
| LOOKUP era ON author
| LIMIT 5
""",
"tables": {
"era": {
"author": {"keyword": ["Frank Herbert", "Peter F. Hamilton", "Vernor Vinge", "Alastair Reynolds", "James S.A. Corey"]},
"era": {"keyword": [ "The New Wave", "Diamond", "Diamond", "Diamond", "Hadron"]}
}
}
}
----
// TEST[setup:library]
Which returns:
[source,text]
----
name | author | era
--------------------+-----------------+---------------
Pandora's Star |Peter F. Hamilton|Diamond
A Fire Upon the Deep|Vernor Vinge |Diamond
Dune |Frank Herbert |The New Wave
Revelation Space |Alastair Reynolds|Diamond
Leviathan Wakes |James S.A. Corey |Hadron
----
// TESTRESPONSE[s/\|/\\|/ s/\+/\\+/]
// TESTRESPONSE[non_json]
// end::examples[]