diff --git a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md index d000d79e0c433..0e9cff4fcefe5 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md +++ b/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?") ``` diff --git a/docs/reference/query-languages/esql/kibana/definition/operators/like.json b/docs/reference/query-languages/esql/kibana/definition/operators/like.json index 49a455421a17e..97c88faa6e8fe 100644 --- a/docs/reference/query-languages/esql/kibana/definition/operators/like.json +++ b/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" : [ diff --git a/docs/reference/query-languages/esql/kibana/definition/operators/not like.json b/docs/reference/query-languages/esql/kibana/definition/operators/not like.json index e24559de82f59..8fbaf03df75df 100644 --- a/docs/reference/query-languages/esql/kibana/definition/operators/not like.json +++ b/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" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/operators/like.md b/docs/reference/query-languages/esql/kibana/docs/operators/like.md index ff351eb71bd9a..52bfeb6f3ff95 100644 --- a/docs/reference/query-languages/esql/kibana/docs/operators/like.md +++ b/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: diff --git a/docs/reference/query-languages/esql/kibana/docs/operators/not like.md b/docs/reference/query-languages/esql/kibana/docs/operators/not like.md index 155eb473c2d93..6164a03110755 100644 --- a/docs/reference/query-languages/esql/kibana/docs/operators/not like.md +++ b/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: diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/WildcardLike.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/WildcardLike.java index d7d1973fceda1..7f350243dc220 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/WildcardLike.java +++ b/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 { 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 @@ also act on a constant (literal) expression. The right-hand side of the operator <> - <> - 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. + + <> + """, operator = NAME, examples = @Example(file = "docs", tag = "like")) public WildcardLike( Source source,