From f6747fdf281d0f51229fdf16d084e7d69ce5d54b Mon Sep 17 00:00:00 2001 From: Charlotte Hoblik Date: Fri, 19 Dec 2025 12:53:13 +0100 Subject: [PATCH 1/2] Add information about text fields --- .../esql/_snippets/operators/detailedDescription/like.md | 4 ++++ .../esql/_snippets/operators/detailedDescription/rlike.md | 4 ++++ .../esql/expression/function/scalar/string/regex/RLike.java | 4 ++++ .../expression/function/scalar/string/regex/WildcardLike.java | 4 ++++ 4 files changed, 16 insertions(+) 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..74ec11bd8d19c 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-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..040cdb84f63be 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-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..3e6de51832c1b 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-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..cdb95e574ccad 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-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. From a679feec6f9d7127b914375631431a2c1861932c Mon Sep 17 00:00:00 2001 From: Charlotte Hoblik Date: Fri, 19 Dec 2025 14:37:20 +0100 Subject: [PATCH 2/2] Fix line length --- .../esql/_snippets/operators/detailedDescription/like.md | 2 +- .../esql/_snippets/operators/detailedDescription/rlike.md | 2 +- .../esql/expression/function/scalar/string/regex/RLike.java | 2 +- .../expression/function/scalar/string/regex/WildcardLike.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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 74ec11bd8d19c..b397543094a34 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md +++ b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/like.md @@ -2,7 +2,7 @@ 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr) functions. +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, 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 040cdb84f63be..a56d332c66806 100644 --- a/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md +++ b/docs/reference/query-languages/esql/_snippets/operators/detailedDescription/rlike.md @@ -2,7 +2,7 @@ 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr) functions. +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, 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 3e6de51832c1b..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 @@ -43,7 +43,7 @@ public class RLike extends RegexMatch { 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr) functions. + 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, 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 cdb95e574ccad..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 @@ -53,7 +53,7 @@ also act on a constant (literal) expression. The right-hand side of the operator 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`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) or [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr) functions. + 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,