Skip to content

Commit a4af548

Browse files
authored
ES|QL - Add scoring for full text functions disjunctions (elastic#121793) (elastic#124573)
1 parent 4af2e24 commit a4af548

File tree

22 files changed

+1609
-680
lines changed

22 files changed

+1609
-680
lines changed

docs/changelog/121793.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121793
2+
summary: "ES|QL - Add scoring for full text functions disjunctions"
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/reference/query-languages/esql/limitations.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ In addition, when [querying multiple indexes](docs-content://explore-analyze/que
117117

118118
## Full-text search [esql-limitations-full-text-search]
119119

120-
[preview] {{esql}}'s support for [full-text search](/reference/query-languages/esql/esql-functions-operators.md#esql-search-functions) is currently in Technical Preview. One limitation of full-text search is that it is necessary to use the search function, like [`MATCH`](/reference/query-languages/esql/esql-functions-operators.md#esql-match), in a [`WHERE`](/reference/query-languages/esql/esql-commands.md#esql-where) command directly after the [`FROM`](/reference/query-languages/esql/esql-commands.md#esql-from) source command, or close enough to it. Otherwise, the query will fail with a validation error. Another limitation is that any [`WHERE`](/reference/query-languages/esql/esql-commands.md#esql-where) command containing a full-text search function cannot use disjunctions (`OR`), unless:
121-
122-
* All functions used in the OR clauses are full-text functions themselves, or scoring is not used
120+
[preview] {{esql}}'s support for [full-text search](/reference/query-languages/esql/esql-functions-operators.md#esql-search-functions) is currently in Technical Preview. One limitation of full-text search is that it is necessary to use the search function, like [`MATCH`](/reference/query-languages/esql/esql-functions-operators.md#esql-match), in a [`WHERE`](/reference/query-languages/esql/esql-commands.md#esql-where) command directly after the [`FROM`](/reference/query-languages/esql/esql-commands.md#esql-from) source command, or close enough to it. Otherwise, the query will fail with a validation error.
123121

124122
For example, this query is valid:
125123

@@ -136,27 +134,6 @@ FROM books
136134
| WHERE MATCH(author, "Faulkner")
137135
```
138136

139-
And this query that uses a disjunction will succeed:
140-
141-
```esql
142-
FROM books
143-
| WHERE MATCH(author, "Faulkner") OR QSTR("author: Hemingway")
144-
```
145-
146-
However using scoring will fail because it uses a non full text function as part of the disjunction:
147-
148-
```esql
149-
FROM books METADATA _score
150-
| WHERE MATCH(author, "Faulkner") OR author LIKE "Hemingway"
151-
```
152-
153-
Scoring will work in the following query, as it uses full text functions on both `OR` clauses:
154-
155-
```esql
156-
FROM books METADATA _score
157-
| WHERE MATCH(author, "Faulkner") OR QSTR("author: Hemingway")
158-
```
159-
160137
Note that, because of [the way {{esql}} treats `text` values](#esql-limitations-text-fields), any queries on `text` fields that do not explicitly use the full-text functions, [`MATCH`](/reference/query-languages/esql/esql-functions-operators.md#esql-match), [`QSTR`](/reference/query-languages/esql/esql-functions-operators.md#esql-qstr) or [`KQL`](/reference/query-languages/esql/esql-functions-operators.md#esql-kql), will behave as if the fields are actually `keyword` fields: they are case-sensitive and need to match the full string.
161138

162139

0 commit comments

Comments
 (0)