Skip to content

Commit 3f1fed0

Browse files
authored
ESQL - Remove restrictions for disjunctions in full text functions (#118544)
1 parent a0ce742 commit 3f1fed0

File tree

11 files changed

+364
-100
lines changed

11 files changed

+364
-100
lines changed

docs/changelog/118544.yaml

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

x-pack/plugin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,6 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
9494
task.skipTest("privileges/11_builtin/Test get builtin privileges" ,"unnecessary to test compatibility")
9595
task.skipTest("esql/61_enrich_ip/Invalid IP strings", "We switched from exceptions to null+warnings for ENRICH runtime errors")
9696
task.skipTest("esql/180_match_operator/match with non text field", "Match operator can now be used on non-text fields")
97+
task.skipTest("esql/180_match_operator/match with functions", "Error message changed")
9798
})
9899

x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-function.csv-spec

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,80 @@ book_no:keyword | title:text
115115
7140 |The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
116116
;
117117

118+
matchWithDisjunction
119+
required_capability: match_function
120+
required_capability: full_text_functions_disjunctions
121+
122+
from books
123+
| where match(author, "Vonnegut") or match(author, "Guinane")
124+
| keep book_no, author;
125+
ignoreOrder:true
126+
127+
book_no:keyword | author:text
128+
2464 | Kurt Vonnegut
129+
6970 | Edith Vonnegut
130+
8956 | Kurt Vonnegut
131+
3950 | Kurt Vonnegut
132+
4382 | Carole Guinane
133+
;
134+
135+
matchWithDisjunctionAndFiltersConjunction
136+
required_capability: match_function
137+
required_capability: full_text_functions_disjunctions
138+
139+
from books
140+
| where (match(author, "Vonnegut") or match(author, "Guinane")) and year > 1997
141+
| keep book_no, author, year;
142+
ignoreOrder:true
143+
144+
book_no:keyword | author:text | year:integer
145+
6970 | Edith Vonnegut | 1998
146+
4382 | Carole Guinane | 2001
147+
;
148+
149+
matchWithDisjunctionAndConjunction
150+
required_capability: match_function
151+
required_capability: full_text_functions_disjunctions
152+
153+
from books
154+
| where (match(author, "Vonnegut") or match(author, "Marquez")) and match(description, "realism")
155+
| keep book_no;
156+
157+
book_no:keyword
158+
4814
159+
;
160+
161+
matchWithMoreComplexDisjunctionAndConjunction
162+
required_capability: match_function
163+
required_capability: full_text_functions_disjunctions
164+
165+
from books
166+
| where (match(author, "Vonnegut") and match(description, "charming")) or (match(author, "Marquez") and match(description, "realism"))
167+
| keep book_no;
168+
ignoreOrder:true
169+
170+
book_no:keyword
171+
6970
172+
4814
173+
;
174+
175+
matchWithDisjunctionIncludingConjunction
176+
required_capability: match_function
177+
required_capability: full_text_functions_disjunctions
178+
179+
from books
180+
| where match(author, "Vonnegut") or (match(author, "Marquez") and match(description, "realism"))
181+
| keep book_no;
182+
ignoreOrder:true
183+
184+
book_no:keyword
185+
2464
186+
6970
187+
4814
188+
8956
189+
3950
190+
;
191+
118192
matchWithFunctionPushedToLucene
119193
required_capability: match_function
120194

x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-operator.csv-spec

Lines changed: 98 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,81 @@ book_no:keyword | title:text
102102
7140 |The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
103103
;
104104

105+
106+
matchWithDisjunction
107+
required_capability: match_operator_colon
108+
required_capability: full_text_functions_disjunctions
109+
110+
from books
111+
| where author : "Vonnegut" or author : "Guinane"
112+
| keep book_no, author;
113+
ignoreOrder:true
114+
115+
book_no:keyword | author:text
116+
2464 | Kurt Vonnegut
117+
6970 | Edith Vonnegut
118+
8956 | Kurt Vonnegut
119+
3950 | Kurt Vonnegut
120+
4382 | Carole Guinane
121+
;
122+
123+
matchWithDisjunctionAndFiltersConjunction
124+
required_capability: match_operator_colon
125+
required_capability: full_text_functions_disjunctions
126+
127+
from books
128+
| where (author : "Vonnegut" or author : "Guinane") and year > 1997
129+
| keep book_no, author, year;
130+
ignoreOrder:true
131+
132+
book_no:keyword | author:text | year:integer
133+
6970 | Edith Vonnegut | 1998
134+
4382 | Carole Guinane | 2001
135+
;
136+
137+
matchWithDisjunctionAndConjunction
138+
required_capability: match_operator_colon
139+
required_capability: full_text_functions_disjunctions
140+
141+
from books
142+
| where (author : "Vonnegut" or author : "Marquez") and description : "realism"
143+
| keep book_no;
144+
145+
book_no:keyword
146+
4814
147+
;
148+
149+
matchWithMoreComplexDisjunctionAndConjunction
150+
required_capability: match_function
151+
required_capability: full_text_functions_disjunctions
152+
153+
from books
154+
| where (author : "Vonnegut" and description : "charming") or (author : "Marquez" and description : "realism")
155+
| keep book_no;
156+
ignoreOrder:true
157+
158+
book_no:keyword
159+
6970
160+
4814
161+
;
162+
163+
matchWithDisjunctionIncludingConjunction
164+
required_capability: match_operator_colon
165+
required_capability: full_text_functions_disjunctions
166+
167+
from books
168+
| where author : "Vonnegut" or (author : "Marquez" and description : "realism")
169+
| keep book_no;
170+
ignoreOrder:true
171+
172+
book_no:keyword
173+
2464
174+
6970
175+
4814
176+
8956
177+
3950
178+
;
179+
105180
matchWithFunctionPushedToLucene
106181
required_capability: match_operator_colon
107182

@@ -219,7 +294,7 @@ count(*): long | author.keyword:keyword
219294
;
220295

221296
testMatchBooleanField
222-
required_capability: match_function
297+
required_capability: match_operator_colon
223298
required_capability: match_additional_types
224299

225300
from employees
@@ -235,7 +310,7 @@ Amabile | true | 2.09
235310
;
236311

237312
testMatchIntegerField
238-
required_capability: match_function
313+
required_capability: match_operator_colon
239314
required_capability: match_additional_types
240315

241316
from employees
@@ -247,7 +322,7 @@ emp_no:integer | first_name:keyword
247322
;
248323

249324
testMatchDoubleField
250-
required_capability: match_function
325+
required_capability: match_operator_colon
251326
required_capability: match_additional_types
252327

253328
from employees
@@ -259,7 +334,7 @@ emp_no:integer | salary_change:double
259334
;
260335

261336
testMatchLongField
262-
required_capability: match_function
337+
required_capability: match_operator_colon
263338
required_capability: match_additional_types
264339

265340
from date_nanos
@@ -271,7 +346,7 @@ num:long
271346
;
272347

273348
testMatchUnsignedLongField
274-
required_capability: match_function
349+
required_capability: match_operator_colon
275350
required_capability: match_additional_types
276351

277352
from ul_logs
@@ -283,7 +358,7 @@ bytes_out:unsigned_long
283358
;
284359

285360
testMatchIpFieldAsString
286-
required_capability: match_function
361+
required_capability: match_operator_colon
287362
required_capability: match_additional_types
288363

289364
from sample_data
@@ -295,7 +370,7 @@ client_ip:ip | message:keyword
295370
;
296371

297372
testMatchDateFieldAsString
298-
required_capability: match_function
373+
required_capability: match_operator_colon
299374
required_capability: match_additional_types
300375

301376
from date_nanos
@@ -307,7 +382,7 @@ millis:date
307382
;
308383

309384
testMatchDateNanosFieldAsString
310-
required_capability: match_function
385+
required_capability: match_operator_colon
311386
required_capability: match_additional_types
312387

313388
from date_nanos
@@ -319,7 +394,7 @@ nanos:date_nanos
319394
;
320395

321396
testMatchBooleanFieldAsString
322-
required_capability: match_function
397+
required_capability: match_operator_colon
323398
required_capability: match_additional_types
324399

325400
from employees
@@ -335,7 +410,7 @@ Amabile | true | 2.09
335410
;
336411

337412
testMatchIntegerFieldAsString
338-
required_capability: match_function
413+
required_capability: match_operator_colon
339414
required_capability: match_additional_types
340415

341416
from employees
@@ -347,7 +422,7 @@ emp_no:integer | first_name:keyword
347422
;
348423

349424
testMatchDoubleFieldAsString
350-
required_capability: match_function
425+
required_capability: match_operator_colon
351426
required_capability: match_additional_types
352427

353428
from employees
@@ -359,7 +434,7 @@ emp_no:integer | salary_change:double
359434
;
360435

361436
testMatchLongFieldAsString
362-
required_capability: match_function
437+
required_capability: match_operator_colon
363438
required_capability: match_additional_types
364439

365440
from date_nanos
@@ -371,7 +446,7 @@ num:long
371446
;
372447

373448
testMatchUnsignedLongFieldAsString
374-
required_capability: match_function
449+
required_capability: match_operator_colon
375450
required_capability: match_additional_types
376451

377452
from ul_logs
@@ -383,7 +458,7 @@ bytes_out:unsigned_long
383458
;
384459

385460
testMatchVersionFieldAsString
386-
required_capability: match_function
461+
required_capability: match_operator_colon
387462
required_capability: match_additional_types
388463

389464
from apps
@@ -395,7 +470,7 @@ bbbbb | 2.1
395470
;
396471

397472
testMatchIntegerAsDouble
398-
required_capability: match_function
473+
required_capability: match_operator_colon
399474
required_capability: match_additional_types
400475

401476
from employees
@@ -408,7 +483,7 @@ emp_no:integer | first_name:keyword
408483
;
409484

410485
testMatchDoubleAsIntegerField
411-
required_capability: match_function
486+
required_capability: match_operator_colon
412487
required_capability: match_additional_types
413488

414489
from employees
@@ -423,7 +498,7 @@ emp_no:integer | height:double
423498
;
424499

425500
testMatchMultipleFieldTypes
426-
required_capability: match_function
501+
required_capability: match_operator_colon
427502
required_capability: match_additional_types
428503

429504
from employees,employees_incompatible
@@ -440,7 +515,7 @@ emp_as_int:integer | name_as_kw:keyword
440515

441516

442517
testMatchMultipleFieldTypesKeywordText
443-
required_capability: match_function
518+
required_capability: match_operator_colon
444519
required_capability: match_additional_types
445520

446521
from employees,employees_incompatible
@@ -455,7 +530,7 @@ Kazuhito
455530
;
456531

457532
testMatchMultipleFieldTypesDoubleFloat
458-
required_capability: match_function
533+
required_capability: match_operator_colon
459534
required_capability: match_additional_types
460535

461536
from employees,employees_incompatible
@@ -474,7 +549,7 @@ emp_no:integer | height_dbl:double
474549
;
475550

476551
testMatchMultipleFieldTypesBooleanKeyword
477-
required_capability: match_function
552+
required_capability: match_operator_colon
478553
required_capability: match_additional_types
479554

480555
from employees,employees_incompatible
@@ -491,7 +566,7 @@ true
491566
;
492567

493568
testMatchMultipleFieldTypesLongUnsignedLong
494-
required_capability: match_function
569+
required_capability: match_operator_colon
495570
required_capability: match_additional_types
496571

497572
from employees,employees_incompatible
@@ -506,7 +581,7 @@ avg_worked_seconds_ul:unsigned_long
506581
;
507582

508583
testMatchMultipleFieldTypesDateNanosDate
509-
required_capability: match_function
584+
required_capability: match_operator_colon
510585
required_capability: match_additional_types
511586

512587
from employees,employees_incompatible
@@ -521,7 +596,7 @@ hire_date_nanos:date_nanos
521596
;
522597

523598
testMatchWithWrongFieldValue
524-
required_capability: match_function
599+
required_capability: match_operator_colon
525600
required_capability: match_additional_types
526601

527602
from employees,employees_incompatible

0 commit comments

Comments
 (0)