Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/120360.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 120360
summary: ESQL - Add Match function options
area: ES|QL
type: feature
issues: []
44 changes: 44 additions & 0 deletions docs/reference/esql/esql-syntax.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,47 @@ Timespan literals are not whitespace sensitive. These expressions are all valid:
* `1 day`
* `1 day`

[discrete]
[[esql-function-named-params]]
==== Function named parameters

Some functions like <<esql-match,match>> use named parameters to provide additional options.

Named parameters allow specifying name value pairs, using the following syntax:

`{"option_name": option_value, "another_option_name": another_value}`

Valid value types are strings, numbers and booleans.

An example using <<esql-match,match>>:

[source,console]
----
POST /_query
{
"query": """
FROM library
| WHERE match(author, "Frank Herbert", {"minimum_should_match": 2, "operator": "AND"})
| LIMIT 5
"""
}
----
// TEST[setup:library]

You can also use <<esql-rest-params,query parameters>> in function named parameters:

[source,console]
----
POST /_query
{
"query": """
FROM library
| EVAL year = DATE_EXTRACT("year", release_date)
| WHERE page_count > ? AND match(author, ?, {"minimum_should_match": ?})
| LIMIT 5
""",
"params": [300, "Frank Herbert", 2]
}
----
// TEST[setup:library]

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/description/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion docs/reference/esql/functions/examples/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions docs/reference/esql/functions/functionNamedParams/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/kibana/definition/kql.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

208 changes: 206 additions & 2 deletions docs/reference/esql/functions/kibana/definition/match.json

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/kibana/definition/qstr.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/kibana/docs/kql.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions docs/reference/esql/functions/kibana/docs/match.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/kibana/docs/qstr.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference/esql/functions/layout/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/reference/esql/functions/parameters/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/esql/functions/signature/match.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 30 additions & 30 deletions docs/reference/esql/functions/types/match.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ FROM books
| WHERE KQL("author: Faulkner")
| KEEP book_no, author
| SORT book_no
| LIMIT 5;
| LIMIT 5
// end::kql-with-field[]
;

// tag::kql-with-field-result[]
book_no:keyword | author:text
Expand All @@ -20,8 +21,8 @@ book_no:keyword | author:text
2847 | Colleen Faulkner
2883 | William Faulkner
3293 | Danny Faulkner
;
// end::kql-with-field-result[]
;

kqlWithMultipleFields
required_capability: kql_function
Expand Down
Loading