-
Notifications
You must be signed in to change notification settings - Fork 25.2k
/
Copy pathlookup.disabled
64 lines (53 loc) · 1.59 KB
/
lookup.disabled
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[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[]