Skip to content

Commit be1e4a3

Browse files
committed
ESQL - Add Match function options (#120360)
(cherry picked from commit d91d516) # Conflicts: # docs/reference/esql/functions/description/match.asciidoc # docs/reference/esql/functions/kibana/definition/match.json # docs/reference/esql/functions/kibana/docs/match.md # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java
1 parent d9ae5b2 commit be1e4a3

File tree

60 files changed

+2208
-2192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2208
-2192
lines changed

docs/changelog/120360.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120360
2+
summary: ESQL - Add Match function options
3+
area: ES|QL
4+
type: feature
5+
issues: []

docs/reference/esql/esql-syntax.asciidoc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,47 @@ Timespan literals are not whitespace sensitive. These expressions are all valid:
169169
* `1 day`
170170
* `1 day`
171171

172+
[discrete]
173+
[[esql-function-named-params]]
174+
==== Function named parameters
175+
176+
Some functions like <<esql-match,match>> use named parameters to provide additional options.
177+
178+
Named parameters allow specifying name value pairs, using the following syntax:
179+
180+
`{"option_name": option_value, "another_option_name": another_value}`
181+
182+
Valid value types are strings, numbers and booleans.
183+
184+
An example using <<esql-match,match>>:
185+
186+
[source,console]
187+
----
188+
POST /_query
189+
{
190+
"query": """
191+
FROM library
192+
| WHERE match(author, "Frank Herbert", {"minimum_should_match": 2, "operator": "AND"})
193+
| LIMIT 5
194+
"""
195+
}
196+
----
197+
// TEST[setup:library]
198+
199+
You can also use <<esql-rest-params,query parameters>> in function named parameters:
200+
201+
[source,console]
202+
----
203+
POST /_query
204+
{
205+
"query": """
206+
FROM library
207+
| EVAL year = DATE_EXTRACT("year", release_date)
208+
| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})
209+
| LIMIT 5
210+
""",
211+
"params": [300, "Frank Herbert", 2]
212+
}
213+
----
214+
// TEST[setup:library]
215+

docs/reference/esql/functions/description/match.asciidoc

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/examples/match.asciidoc

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/functionNamedParams/match.asciidoc

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/kql.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/match.json

Lines changed: 206 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/match_operator.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/qstr.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/docs/kql.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)