Browse Source

[DOCS][ESQL] Add versions to the docs for LIKE LIST (#130299)

Clarifies the version applicability for new LIKE function alternative syntax with a list of patterns, added in #129170
Julian Kiryakov 3 months ago
parent
commit
1e6473a427

+ 12 - 5
docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md

@@ -10,17 +10,24 @@ ROW message = "foo * bar"
 ```
 
 
+To reduce the overhead of escaping, we suggest using triple quotes strings `"""`
+
 ```esql
-ROW message = "foobar"
-| WHERE message like ("foo*", "bar?")
+ROW message = "foo * bar"
+| WHERE message LIKE """foo \* bar"""
 ```
 
 
-To reduce the overhead of escaping, we suggest using triple quotes strings `"""`
+```{applies_to}
+stack: ga 9.1
+serverless: ga
+```
+Both a single pattern or a list of patterns are supported. If a list of patterns is provided,
+the expression will return true if any of the patterns match.
 
 ```esql
-ROW message = "foo * bar"
-| WHERE message LIKE """foo \* bar"""
+ROW message = "foobar"
+| WHERE message like ("foo*", "bar?")
 ```
 
 

+ 1 - 1
docs/reference/query-languages/esql/kibana/definition/operators/like.json

@@ -3,7 +3,7 @@
   "type" : "operator",
   "operator" : "LIKE",
   "name" : "like",
-  "description" : "Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern or a list of patterns. If a list of patterns is provided,\nthe expression will return true if any of the patterns match.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.",
+  "description" : "Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.",
   "signatures" : [
     {
       "params" : [

+ 1 - 1
docs/reference/query-languages/esql/kibana/definition/operators/not like.json

@@ -3,7 +3,7 @@
   "type" : "operator",
   "operator" : "not like",
   "name" : "not_like",
-  "description" : "Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern or a list of patterns. If a list of patterns is provided,\nthe expression will return true if any of the patterns match.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.",
+  "description" : "Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.",
   "signatures" : [
     {
       "params" : [

+ 1 - 2
docs/reference/query-languages/esql/kibana/docs/operators/like.md

@@ -4,8 +4,7 @@
 Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`
 usually acts on a field placed on the left-hand side of the operator, but it can
 also act on a constant (literal) expression. The right-hand side of the operator
-represents the pattern or a list of patterns. If a list of patterns is provided,
-the expression will return true if any of the patterns match.
+represents the pattern.
 
 The following wildcard characters are supported:
 

+ 1 - 2
docs/reference/query-languages/esql/kibana/docs/operators/not like.md

@@ -4,8 +4,7 @@
 Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`
 usually acts on a field placed on the left-hand side of the operator, but it can
 also act on a constant (literal) expression. The right-hand side of the operator
-represents the pattern or a list of patterns. If a list of patterns is provided,
-the expression will return true if any of the patterns match.
+represents the pattern.
 
 The following wildcard characters are supported:
 

+ 11 - 4
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/WildcardLike.java

@@ -38,8 +38,7 @@ public class WildcardLike extends RegexMatch<WildcardPattern> {
         Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`
         usually acts on a field placed on the left-hand side of the operator, but it can
         also act on a constant (literal) expression. The right-hand side of the operator
-        represents the pattern or a list of patterns. If a list of patterns is provided,
-        the expression will return true if any of the patterns match.
+        represents the pattern.
 
         The following wildcard characters are supported:
 
@@ -51,11 +50,19 @@ public class WildcardLike extends RegexMatch<WildcardPattern> {
 
         <<load-esql-example, file=string tag=likeEscapingSingleQuotes>>
 
-        <<load-esql-example, file=where-like tag=likeListDocExample>>
-
         To reduce the overhead of escaping, we suggest using triple quotes strings `\"\"\"`
 
         <<load-esql-example, file=string tag=likeEscapingTripleQuotes>>
+
+        ```{applies_to}
+        stack: ga 9.1
+        serverless: ga
+        ```
+        Both a single pattern or a list of patterns are supported. If a list of patterns is provided,
+        the expression will return true if any of the patterns match.
+
+        <<load-esql-example, file=where-like tag=likeListDocExample>>
+
         """, operator = NAME, examples = @Example(file = "docs", tag = "like"))
     public WildcardLike(
         Source source,