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 dbaa8a3c32209..b397543094a34 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md +++ b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md @@ -1,5 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. +When used on `text` fields, `LIKE` treats the field as a `keyword` and does not use the analyzer. +This means the pattern matching is case-sensitive and must match the exact string indexed. +To perform full-text search, use the `MATCH` or `QSTR` functions. + Matching the exact characters `*` and `.` will require escaping. The escape character is backslash `\`. Since also backslash is a special character in string literals, it will require further escaping. diff --git a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md index 316ae8f5a28b2..a56d332c66806 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md +++ b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md @@ -1,5 +1,9 @@ % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it. +When used on `text` fields, `RLIKE` treats the field as a `keyword` and does not use the analyzer. +This means the pattern matching is case-sensitive and must match the exact string indexed. +To perform full-text search, use the `MATCH` or `QSTR` functions. + Matching special characters (eg. `.`, `*`, `(`...) will require escaping. The escape character is backslash `\`. Since also backslash is a special character in string literals, it will require further escaping. diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java index afbc9d8dd0f62..9c2a27ce11260 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java @@ -41,6 +41,10 @@ public class RLike extends RegexMatch { // we use an inline example here because ?pattern not supported in csv-spec test detailedDescription = """ + When used on `text` fields, `RLIKE` treats the field as a `keyword` and does not use the analyzer. + This means the pattern matching is case-sensitive and must match the exact string indexed. + To perform full-text search, use the `MATCH` or `QSTR` functions. + Matching special characters (eg. `.`, `*`, `(`...) will require escaping. The escape character is backslash `\\`. Since also backslash is a special character in string literals, it will require further escaping. 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 28a4eaead2e72..6e4adab1fa2e1 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 @@ -51,6 +51,10 @@ also act on a constant (literal) expression. The right-hand side of the operator // we use an inline example here because ?pattern not supported in csv-spec test detailedDescription = """ + When used on `text` fields, `LIKE` treats the field as a `keyword` and does not use the analyzer. + This means the pattern matching is case-sensitive and must match the exact string indexed. + To perform full-text search, use the `MATCH` or `QSTR` functions. + Matching the exact characters `*` and `.` will require escaping. The escape character is backslash `\\`. Since also backslash is a special character in string literals, it will require further escaping.