Skip to content

Commit 58c1c70

Browse files
committed
WIP - initial rewording
1 parent e0763c2 commit 58c1c70

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

docs/reference/esql/esql-limitations.asciidoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ it is necessary to use the search function, like <<esql-match>>, in a <<esql-whe
112112
directly after the <<esql-from>> source command, or close enough to it.
113113
Otherwise, the query will fail with a validation error.
114114
Another limitation is that any <<esql-where>> command containing a full-text search function
115-
cannot also use disjunctions (`OR`).
115+
cannot also use disjunctions (`OR`) unless all functions used in the OR clauses are full-text functions themselves.
116116

117117
For example, this query is valid:
118118

@@ -139,6 +139,15 @@ FROM books
139139
| WHERE MATCH(author, "Faulkner") OR author LIKE "Hemingway"
140140
----
141141

142+
but this one will succeed, as it uses full text functions on both OR clauses:
143+
144+
[source,esql]
145+
----
146+
FROM books
147+
| WHERE MATCH(author, "Faulkner") OR QSTR("author: Hemingway")
148+
----
149+
150+
142151
Note that, because of <<esql-limitations-text-fields,the way {esql} treats `text` values>>,
143152
any queries on `text` fields that do not explicitly use the full-text functions,
144153
<<esql-match>> or <<esql-qstr>>, will behave as if the fields are actually `keyword` fields:

docs/reference/esql/functions/search-functions.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
++++
77

88
Full text functions are used to search for text in fields.
9-
<<analysis, Text analysiss>> is used to analyze the query before it is searched.
9+
<<analysis, Text analysis>> is used to analyze the query before it is searched.
1010

1111
Full text functions can be used to match <<esql-multivalued-fields,multivalued fields>>.
1212
A multivalued field that contains a value that matches a full text query is considered to match the query.
1313

14+
Full text functions are more performant for text search use cases than using pattern matching or regular expressions with `LIKE` or `RLIKE`.
15+
1416
See <<esql-limitations-full-text-search,full text search limitations>> for information on the limitations of full text search.
1517

1618
{esql} supports these full-text search functions:

docs/reference/esql/processing-commands/where.asciidoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ the input table for which the provided condition evaluates to `true`.
77

88
[TIP]
99
====
10-
In case of value exclusions, fields with `null` values will be excluded from search results.
10+
In case of value exclusions, fields with `null` values will be excluded from search results.
1111
In this context a `null` means either there is an explicit `null` value in the document or there is no value at all.
1212
For example: `WHERE field != "value"` will be interpreted as `WHERE field != "value" AND field IS NOT NULL`.
1313
====
@@ -58,6 +58,10 @@ For a complete list of all functions, refer to <<esql-functions>>.
5858

5959
include::../functions/predicates.asciidoc[tag=body]
6060

61+
For matching text, you can use <<serch-functions,full text search functions>> like `MATCH`.
62+
63+
include::../functions/match.asciidoc[tag=body]
64+
6165
include::../functions/like.asciidoc[tag=body]
6266

6367
include::../functions/rlike.asciidoc[tag=body]

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,15 @@ public class Match extends FullTextFunction implements Validatable {
9696
@FunctionInfo(
9797
returnType = "boolean",
9898
preview = true,
99-
description = "Performs a <<query-dsl-match-query,match query>> on the specified field. "
100-
+ "Returns true if the provided query matches the row.",
101-
examples = { @Example(file = "match-function", tag = "match-with-field") }
99+
description = """
100+
Use `MATCH` to perform a <<query-dsl-match-query,match query>> on the specified field.
101+
Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.
102+
103+
Match can be used on text fields, as well as other field types like boolean, dates, and numeric types.
104+
105+
For a simplified syntax, you can use the <<esql-search-operators,match operator>> `:` operator instead of `MATCH`.
106+
`MATCH` returns true if the provided query matches the row.
107+
""", examples = { @Example(file = "match-function", tag = "match-with-field") }
102108
)
103109
public Match(
104110
Source source,

0 commit comments

Comments
 (0)