ESQL - match operator included in non-snapshot builds (#116819)

This commit is contained in:
Carlos Delgado 2024-11-21 07:45:22 +01:00 committed by GitHub
parent adcc5bed1e
commit ea4b41fca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 1963 additions and 1837 deletions

View file

@ -0,0 +1,49 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "operator",
"name" : "match_operator",
"description" : "Performs a match query on the specified field. Returns true if the provided query matches the row.",
"signatures" : [
{
"params" : [
{
"name" : "field",
"type" : "keyword",
"optional" : false,
"description" : "Field that the query will target."
},
{
"name" : "query",
"type" : "keyword",
"optional" : false,
"description" : "Text you wish to find in the provided field."
}
],
"variadic" : false,
"returnType" : "boolean"
},
{
"params" : [
{
"name" : "field",
"type" : "text",
"optional" : false,
"description" : "Field that the query will target."
},
{
"name" : "query",
"type" : "text",
"optional" : false,
"description" : "Text you wish to find in the provided field."
}
],
"variadic" : false,
"returnType" : "boolean"
}
],
"examples" : [
"FROM books \n| WHERE MATCH(author, \"Faulkner\")\n| KEEP book_no, author \n| SORT book_no \n| LIMIT 5;"
],
"preview" : true,
"snapshot_only" : false
}

View file

@ -0,0 +1,14 @@
<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->
### MATCH_OPERATOR
Performs a match query on the specified field. Returns true if the provided query matches the row.
```
FROM books
| WHERE MATCH(author, "Faulkner")
| KEEP book_no, author
| SORT book_no
| LIMIT 5;
```

View file

@ -16,6 +16,7 @@ Boolean operators for comparing against one or multiple expressions.
* <<esql-in-operator>>
* <<esql-like-operator>>
* <<esql-rlike-operator>>
* experimental:[] <<esql-search-operators>>
// end::op_list[]
include::binary.asciidoc[]
@ -26,3 +27,4 @@ include::cast.asciidoc[]
include::in.asciidoc[]
include::like.asciidoc[]
include::rlike.asciidoc[]
include::search.asciidoc[]

View file

@ -0,0 +1,23 @@
[discrete]
[[esql-search-operators]]
=== Search operators
The only search operator is match (`:`).
preview::["Do not use on production environments. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."]
The match operator performs a <<query-dsl-match-query,match query>> on the specified field. Returns true if the provided query matches the row.
[.text-center]
image::esql/functions/signature/match_operator.svg[Embedded,opts=inline]
include::types/match.asciidoc[]
[source.merge.styled,esql]
----
include::{esql-specs}/match-operator.csv-spec[tag=match-with-field]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/match-operator.csv-spec[tag=match-with-field-result]
|===

View file

@ -0,0 +1 @@
<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="222" height="46" viewbox="0 0 222 46"><defs><style type="text/css">#guide .c{fill:none;stroke:#222222;}#guide .j{fill:#000000;font-family:Roboto Mono,Sans-serif;font-size:20px;}#guide .l{fill:#e4f4ff;stroke:#222222;}#guide .syn{fill:#8D8D8D;font-family:Roboto Mono,Sans-serif;font-size:20px;}</style></defs><path class="c" d="M0 31h5m80 0h10m32 0h10m80 0h5"/><rect class="l" x="5" y="5" width="80" height="36" rx="7"/><text class="j" x="15" y="31">field</text><rect class="l" x="95" y="5" width="32" height="36" rx="7"/><text class="syn" x="105" y="31">:</text><rect class="l" x="137" y="5" width="80" height="36" rx="7"/><text class="j" x="147" y="31">query</text></svg>

After

Width:  |  Height:  |  Size: 775 B

View file

@ -0,0 +1,10 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
*Supported types*
[%header.monospaced.styled,format=dsv,separator=|]
|===
field | query | result
keyword | keyword | boolean
text | text | boolean
|===