Skip to content

Commit

Permalink
ESQL - Remove restrictions for disjunctions in full text functions (e…
Browse files Browse the repository at this point in the history
…lastic#118544) (elastic#118918)

(cherry picked from commit 3f1fed0)

# Conflicts:
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LocalPhysicalPlanOptimizerTests.java
  • Loading branch information
carlosdelest authored Dec 18, 2024
1 parent 15b6b1d commit bfb54ea
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 100 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/118544.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 118544
summary: ESQL - Remove restrictions for disjunctions in full text functions
area: ES|QL
type: enhancement
issues: []
1 change: 1 addition & 0 deletions x-pack/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,6 @@ tasks.named("yamlRestTestV7CompatTransform").configure({ task ->
task.skipTest("privileges/11_builtin/Test get builtin privileges" ,"unnecessary to test compatibility")
task.skipTest("esql/61_enrich_ip/Invalid IP strings", "We switched from exceptions to null+warnings for ENRICH runtime errors")
task.skipTest("esql/180_match_operator/match with non text field", "Match operator can now be used on non-text fields")
task.skipTest("esql/180_match_operator/match with functions", "Error message changed")
})

Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,80 @@ book_no:keyword | title:text
7140 |The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
;

matchWithDisjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where match(author, "Vonnegut") or match(author, "Guinane")
| keep book_no, author;
ignoreOrder:true

book_no:keyword | author:text
2464 | Kurt Vonnegut
6970 | Edith Vonnegut
8956 | Kurt Vonnegut
3950 | Kurt Vonnegut
4382 | Carole Guinane
;

matchWithDisjunctionAndFiltersConjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where (match(author, "Vonnegut") or match(author, "Guinane")) and year > 1997
| keep book_no, author, year;
ignoreOrder:true

book_no:keyword | author:text | year:integer
6970 | Edith Vonnegut | 1998
4382 | Carole Guinane | 2001
;

matchWithDisjunctionAndConjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where (match(author, "Vonnegut") or match(author, "Marquez")) and match(description, "realism")
| keep book_no;

book_no:keyword
4814
;

matchWithMoreComplexDisjunctionAndConjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where (match(author, "Vonnegut") and match(description, "charming")) or (match(author, "Marquez") and match(description, "realism"))
| keep book_no;
ignoreOrder:true

book_no:keyword
6970
4814
;

matchWithDisjunctionIncludingConjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where match(author, "Vonnegut") or (match(author, "Marquez") and match(description, "realism"))
| keep book_no;
ignoreOrder:true

book_no:keyword
2464
6970
4814
8956
3950
;

matchWithFunctionPushedToLucene
required_capability: match_function

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,81 @@ book_no:keyword | title:text
7140 |The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
;


matchWithDisjunction
required_capability: match_operator_colon
required_capability: full_text_functions_disjunctions

from books
| where author : "Vonnegut" or author : "Guinane"
| keep book_no, author;
ignoreOrder:true

book_no:keyword | author:text
2464 | Kurt Vonnegut
6970 | Edith Vonnegut
8956 | Kurt Vonnegut
3950 | Kurt Vonnegut
4382 | Carole Guinane
;

matchWithDisjunctionAndFiltersConjunction
required_capability: match_operator_colon
required_capability: full_text_functions_disjunctions

from books
| where (author : "Vonnegut" or author : "Guinane") and year > 1997
| keep book_no, author, year;
ignoreOrder:true

book_no:keyword | author:text | year:integer
6970 | Edith Vonnegut | 1998
4382 | Carole Guinane | 2001
;

matchWithDisjunctionAndConjunction
required_capability: match_operator_colon
required_capability: full_text_functions_disjunctions

from books
| where (author : "Vonnegut" or author : "Marquez") and description : "realism"
| keep book_no;

book_no:keyword
4814
;

matchWithMoreComplexDisjunctionAndConjunction
required_capability: match_function
required_capability: full_text_functions_disjunctions

from books
| where (author : "Vonnegut" and description : "charming") or (author : "Marquez" and description : "realism")
| keep book_no;
ignoreOrder:true

book_no:keyword
6970
4814
;

matchWithDisjunctionIncludingConjunction
required_capability: match_operator_colon
required_capability: full_text_functions_disjunctions

from books
| where author : "Vonnegut" or (author : "Marquez" and description : "realism")
| keep book_no;
ignoreOrder:true

book_no:keyword
2464
6970
4814
8956
3950
;

matchWithFunctionPushedToLucene
required_capability: match_operator_colon

Expand Down Expand Up @@ -219,7 +294,7 @@ count(*): long | author.keyword:keyword
;

testMatchBooleanField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -235,7 +310,7 @@ Amabile | true | 2.09
;

testMatchIntegerField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -247,7 +322,7 @@ emp_no:integer | first_name:keyword
;

testMatchDoubleField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -259,7 +334,7 @@ emp_no:integer | salary_change:double
;

testMatchLongField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from date_nanos
Expand All @@ -271,7 +346,7 @@ num:long
;

testMatchUnsignedLongField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from ul_logs
Expand All @@ -283,7 +358,7 @@ bytes_out:unsigned_long
;

testMatchIpFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from sample_data
Expand All @@ -295,7 +370,7 @@ client_ip:ip | message:keyword
;

testMatchDateFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from date_nanos
Expand All @@ -307,7 +382,7 @@ millis:date
;

testMatchDateNanosFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from date_nanos
Expand All @@ -319,7 +394,7 @@ nanos:date_nanos
;

testMatchBooleanFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -335,7 +410,7 @@ Amabile | true | 2.09
;

testMatchIntegerFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -347,7 +422,7 @@ emp_no:integer | first_name:keyword
;

testMatchDoubleFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -359,7 +434,7 @@ emp_no:integer | salary_change:double
;

testMatchLongFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from date_nanos
Expand All @@ -371,7 +446,7 @@ num:long
;

testMatchUnsignedLongFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from ul_logs
Expand All @@ -383,7 +458,7 @@ bytes_out:unsigned_long
;

testMatchVersionFieldAsString
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from apps
Expand All @@ -395,7 +470,7 @@ bbbbb | 2.1
;

testMatchIntegerAsDouble
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -408,7 +483,7 @@ emp_no:integer | first_name:keyword
;

testMatchDoubleAsIntegerField
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees
Expand All @@ -423,7 +498,7 @@ emp_no:integer | height:double
;

testMatchMultipleFieldTypes
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

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


testMatchMultipleFieldTypesKeywordText
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand All @@ -455,7 +530,7 @@ Kazuhito
;

testMatchMultipleFieldTypesDoubleFloat
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand All @@ -474,7 +549,7 @@ emp_no:integer | height_dbl:double
;

testMatchMultipleFieldTypesBooleanKeyword
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand All @@ -491,7 +566,7 @@ true
;

testMatchMultipleFieldTypesLongUnsignedLong
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand All @@ -506,7 +581,7 @@ avg_worked_seconds_ul:unsigned_long
;

testMatchMultipleFieldTypesDateNanosDate
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand All @@ -521,7 +596,7 @@ hire_date_nanos:date_nanos
;

testMatchWithWrongFieldValue
required_capability: match_function
required_capability: match_operator_colon
required_capability: match_additional_types

from employees,employees_incompatible
Expand Down
Loading

0 comments on commit bfb54ea

Please sign in to comment.