@@ -102,33 +102,46 @@ is currently experimental.
102102
103103[discrete]
104104[[esql-limitations-full-text-search]]
105- === Full-text search is not supported
105+ === Full-text search
106106
107- Because of <<esql-limitations-text-fields,the way {esql} treats `text` values>>,
108- full-text search is not yet supported. Queries on `text` fields are like queries
109- on `keyword` fields: they are case-sensitive and need to match the full string.
107+ experimental:[] {esql}'s support for <<esql-search-functions,full-text search>>
108+ is currently in Technical Preview. One limitation of full-text search is that
109+ it is necessary to use the search function, like <<esql-match>>, in a <<esql-where>> command
110+ directly after the <<esql-from>> source command, or close enough to it.
111+ Otherwise, the query will fail with a validation error.
112+ Another limitation is that any <<esql-where>> command containing a full-text search function
113+ cannot also use disjunctions (`OR`).
114+
115+ For example, this query is valid:
110116
111- For example, after indexing a field of type `text` with the value `Elasticsearch
112- query language`, the following `WHERE` clause does not match because the `LIKE`
113- operator is case-sensitive:
114117[source,esql]
115118----
116- | WHERE field LIKE "elasticsearch query language"
119+ FROM books
120+ | WHERE MATCH(author, "Faulkner") AND MATCH(author, "Tolkien")
117121----
118122
119- The following `WHERE` clause does not match either, because the `LIKE` operator
120- tries to match the whole string:
123+ But this query will fail due to the <<esql-stats-by, STATS>> command:
124+
121125[source,esql]
122126----
123- | WHERE field LIKE "Elasticsearch"
127+ FROM books
128+ | STATS AVG(price) BY author
129+ | WHERE MATCH(author, "Faulkner")
124130----
125131
126- As a workaround, use wildcards and regular expressions. For example:
132+ And this query will fail due to the disjunction:
133+
127134[source,esql]
128135----
129- | WHERE field RLIKE "[Ee]lasticsearch.*"
136+ FROM books
137+ | WHERE MATCH(author, "Faulkner") OR author LIKE "Hemingway"
130138----
131139
140+ Note that, because of <<esql-limitations-text-fields,the way {esql} treats `text` values>>,
141+ any queries on `text` fields that do not explicitly use the full-text functions,
142+ <<esql-match>> or <<esql-qstr>>, will behave as if the fields are actually `keyword` fields:
143+ they are case-sensitive and need to match the full string.
144+
132145[discrete]
133146[[esql-limitations-text-fields]]
134147=== `text` fields behave like `keyword` fields
@@ -141,15 +154,68 @@ that. If it's not possible to retrieve a `keyword` subfield, {esql} will get the
141154string from a document's `_source`. If the `_source` cannot be retrieved, for
142155example when using synthetic source, `null` is returned.
143156
157+ Once a `text` field is retrieved, if the query touches it in any way, for example passing
158+ it into a function, the type will be converted to `keyword`. In fact, functions that operate on both
159+ `text` and `keyword` fields will perform as if the `text` field was a `keyword` field all along.
160+
161+ For example, the following query will return a column `greatest` of type `keyword` no matter
162+ whether any or all of `field1`, `field2`, and `field3` are of type `text`:
163+ [source,esql]
164+ ----
165+ | FROM index
166+ | EVAL greatest = GREATEST(field1, field2, field3)
167+ ----
168+
144169Note that {esql}'s retrieval of `keyword` subfields may have unexpected
145- consequences. An {esql} query on a `text` field is case-sensitive. Furthermore,
146- a subfield may have been mapped with a <<normalizer,normalizer>>, which can
170+ consequences. Other than when explicitly using the full-text functions, <<esql-match>> and <<esql-qstr>>,
171+ any {esql} query on a `text` field is case-sensitive.
172+
173+ For example, after indexing a field of type `text` with the value `Elasticsearch
174+ query language`, the following `WHERE` clause does not match because the `LIKE`
175+ operator is case-sensitive:
176+ [source,esql]
177+ ----
178+ | WHERE field LIKE "elasticsearch query language"
179+ ----
180+
181+ The following `WHERE` clause does not match either, because the `LIKE` operator
182+ tries to match the whole string:
183+ [source,esql]
184+ ----
185+ | WHERE field LIKE "Elasticsearch"
186+ ----
187+
188+ As a workaround, use wildcards and regular expressions. For example:
189+ [source,esql]
190+ ----
191+ | WHERE field RLIKE "[Ee]lasticsearch.*"
192+ ----
193+
194+ Furthermore, a subfield may have been mapped with a <<normalizer,normalizer>>, which can
147195transform the original string. Or it may have been mapped with <<ignore-above>>,
148196which can truncate the string. None of these mapping operations are applied to
149197an {esql} query, which may lead to false positives or negatives.
150198
151199To avoid these issues, a best practice is to be explicit about the field that
152200you query, and query `keyword` sub-fields instead of `text` fields.
201+ Or consider using one of the <<esql-search-functions,full-text search>> functions.
202+
203+ [discrete]
204+ [[esql-multi-index-limitations]]
205+ === Using {esql} to query multiple indices
206+
207+ As discussed in more detail in <<esql-multi-index>>, {esql} can execute a single query across multiple indices,
208+ data streams, or aliases. However, there are some limitations to be aware of:
209+
210+ * All underlying indexes and shards must be active. Using admin commands or UI,
211+ it is possible to pause an index or shard, for example by disabling a frozen tier instance,
212+ but then any {esql} query that includes that index or shard will fail, even if the query uses
213+ <<esql-where>> to filter out the results from the paused index.
214+ If you see an error of type `search_phase_execution_exception`,
215+ with the message `Search rejected due to missing shards`, you likely have an index or shard in `UNASSIGNED` state.
216+ * The same field must have the same type across all indexes. If the same field is mapped to different types
217+ it is still possible to query the indexes,
218+ but the field must be <<esql-multi-index-union-types,explicitly converted to a single type>>.
153219
154220[discrete]
155221[[esql-tsdb]]
0 commit comments