Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ed1e528
Adding KqlQuery to esql-core query dsl supported queries.
afoucret Nov 13, 2024
b7e2a56
Adding KQL_FUNCTION capability.
afoucret Nov 13, 2024
eb81cd8
Change visibility for KqlQueryBuilder parser fields.
afoucret Nov 13, 2024
37d0f38
Creating the KQL fulltext function.
afoucret Nov 13, 2024
a271aea
Register the KQL function in various places.
afoucret Nov 13, 2024
31f45db
Merge branch 'elastic:main' into esql-kql-function
afoucret Nov 14, 2024
e3c1737
Refactoring dependencies on KQL
afoucret Nov 14, 2024
1659381
Remove moved tests.
afoucret Nov 14, 2024
949e8e0
Adding some Verifier tests.
afoucret Nov 18, 2024
27afe86
Fixing telemetry.
afoucret Nov 18, 2024
5f6e321
Add integration test for the KQL function.
afoucret Nov 18, 2024
21a37c8
Adding CSV tests.
afoucret Nov 18, 2024
41f0276
Regenerate documentation for the KQL function.
afoucret Nov 19, 2024
be48540
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 19, 2024
fc0e1e3
Add LogicalPhysicalPlanOptimizer test cases for KQL.
afoucret Nov 19, 2024
9370d55
Fixing some errors in the qstr csv test spec.
afoucret Nov 19, 2024
f02f716
Fix in the doc.
afoucret Nov 19, 2024
ea86e2b
Lint fix.
afoucret Nov 19, 2024
9d99721
Small test change.
afoucret Nov 19, 2024
f0a107f
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 20, 2024
439681f
Fix regression from merge.
afoucret Nov 20, 2024
b5b59ae
Fix regression from merge.
afoucret Nov 20, 2024
5c0083c
Improving tests.
afoucret Nov 20, 2024
d1b975c
Ensure tests will not break on snapshot builds.
afoucret Nov 20, 2024
3f6b75b
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 20, 2024
77e7021
Refactor fulltext functions tests to avoid code duplication.
afoucret Nov 20, 2024
7bf2d14
Remove duplicated Verifier code for QSTR and KQL.
afoucret Nov 20, 2024
f66b657
Sort functions by alphabetical order.
afoucret Nov 20, 2024
247d188
Remove useless override.
afoucret Nov 20, 2024
47f8851
Remove useless annotation.
afoucret Nov 20, 2024
02ea75e
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 20, 2024
2577576
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 22, 2024
abad995
Remove gen files added by mistake
afoucret Nov 22, 2024
d096e9e
Fix test compile after merge from main.
afoucret Nov 22, 2024
cab9a30
Lint fix.
afoucret Nov 25, 2024
f88fc8f
Merge branch 'main' of https://github.com/elastic/elasticsearch into …
afoucret Nov 25, 2024
680014a
Update the number of functions in telemetry.
afoucret Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/reference/esql/functions/description/kql.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/reference/esql/functions/examples/kql.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions docs/reference/esql/functions/kibana/definition/kql.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/reference/esql/functions/kibana/docs/kql.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions docs/reference/esql/functions/layout/kql.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/reference/esql/functions/parameters/kql.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference/esql/functions/signature/kql.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/reference/esql/functions/types/kql.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions x-pack/plugin/esql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
compileOnly project(':modules:lang-painless:spi')
compileOnly project(xpackModule('esql-core'))
compileOnly project(xpackModule('ml'))
implementation project(xpackModule('kql'))
implementation project('compute')
implementation project('compute:ann')
implementation project(':libs:dissect')
Expand All @@ -44,6 +45,7 @@ dependencies {
testImplementation(testArtifact(project(xpackModule('core'))))
testImplementation project(path: xpackModule('enrich'))
testImplementation project(path: xpackModule('spatial'))
testImplementation project(path: xpackModule('kql'))

testImplementation project(path: ':modules:reindex')
testImplementation project(path: ':modules:parent-join')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
###############################################
# Tests for KQL function
#

kqlWithField
required_capability: kql_function

// tag::kql-with-field[]
FROM books
| WHERE KQL("author: Faulkner")
| KEEP book_no, author
| SORT book_no
| LIMIT 5;
// end::kql-with-field[]

// tag::kql-with-field-result[]
book_no:keyword | author:text
2378 | [Carol Faulkner, Holly Byers Ochoa, Lucretia Mott]
2713 | William Faulkner
2847 | Colleen Faulkner
2883 | William Faulkner
3293 | Danny Faulkner
;
// end::kql-with-field-result[]

kqlWithMultipleFields
required_capability: kql_function

from books
| where kql("title:Return* AND author:*Tolkien")
| keep book_no, title;
ignoreOrder:true

book_no:keyword | title:text
2714 | Return of the King Being the Third Part of The Lord of the Rings
7350 | Return of the Shadow
;

kqlWithQueryExpressions
required_capability: kql_function

from books
| where kql(CONCAT("title:Return*", " AND author:*Tolkien"))
| keep book_no, title;
ignoreOrder:true

book_no:keyword | title:text
2714 | Return of the King Being the Third Part of The Lord of the Rings
7350 | Return of the Shadow
;

kqlWithConjunction
required_capability: kql_function

from books
| where kql("title: Rings") and ratings > 4.6
| keep book_no, title;
ignoreOrder:true

book_no:keyword | title:text
4023 | A Tolkien Compass: Including J. R. R. Tolkien's Guide to the Names in The Lord of the Rings
7140 | The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
;

kqlWithFunctionPushedToLucene
required_capability: kql_function

from hosts
| where kql("host: beta") and cidr_match(ip1, "127.0.0.2/32", "127.0.0.3/32")
| keep card, host, ip0, ip1;
ignoreOrder:true

card:keyword |host:keyword |ip0:ip |ip1:ip
eth1 |beta |127.0.0.1 |127.0.0.2
;

kqlWithNonPushableConjunction
required_capability: kql_function

from books
| where kql("title: Rings") and length(title) > 75
| keep book_no, title;
ignoreOrder:true

book_no:keyword | title:text
4023 |A Tolkien Compass: Including J. R. R. Tolkien's Guide to the Names in The Lord of the Rings
;

kqlWithMultipleWhereClauses
required_capability: kql_function

from books
| where kql("title: rings")
| where kql("year > 1 AND year < 2005")
| keep book_no, title;
ignoreOrder:true

book_no:keyword | title:text
4023 | A Tolkien Compass: Including J. R. R. Tolkien's Guide to the Names in The Lord of the Rings
7140 | The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1)
;


kqlWithMultivaluedTextField
required_capability: kql_function

from employees
| where kql("job_positions: Tech Lead AND job_positions:(Reporting Analyst)")
| keep emp_no, first_name, last_name;
ignoreOrder:true

emp_no:integer | first_name:keyword | last_name:keyword
10004 | Chirstian | Koblick
10010 | Duangkaew | Piveteau
10011 | Mary | Sluis
10088 | Jungsoon | Syrzycki
10093 | Sailaja | Desikan
10097 | Remzi | Waschkowski
;

kqlWithMultivaluedNumericField
required_capability: kql_function

from employees
| where kql("salary_change > 14")
| keep emp_no, first_name, last_name, salary_change;
ignoreOrder:true

emp_no:integer | first_name:keyword | last_name:keyword | salary_change:double
10003 | Parto | Bamford | [12.82, 14.68]
10015 | Guoxiang | Nooteboom | [12.4, 14.25]
10023 | Bojan | Montemayor | [0.8, 14.63]
10040 | Weiyi | Meriste | [-8.94, 1.92, 6.97, 14.74]
10061 | Tse | Herber | [-2.58, -0.95, 14.39]
10065 | Satosi | Awdeh | [-9.81, -1.47, 14.44]
10099 | Valter | Sullins | [-8.78, -3.98, 10.71, 14.26]
;

testMultiValuedFieldWithConjunction
required_capability: kql_function

from employees
| where (kql("job_positions: (Data Scientist) OR job_positions:(Support Engineer)")) and gender == "F"
| keep emp_no, first_name, last_name;
ignoreOrder:true

emp_no:integer | first_name:keyword | last_name:keyword
10023 | Bojan | Montemayor
10041 | Uri | Lenart
10044 | Mingsen | Casley
10053 | Sanjiv | Zschoche
10069 | Margareta | Bierman
;
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ book_no:keyword | title:text
;


matchMultivaluedTextField
required_capability: match_function
qstrWithMultivaluedTextField
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR but fixed few errors in the qstr csv spec

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Aurélien!

required_capability: qstr_function

from employees
| where qstr("job_positions: (Tech Lead) AND job_positions:(Reporting Analyst)")
Expand All @@ -118,8 +118,8 @@ emp_no:integer | first_name:keyword | last_name:keyword
10097 | Remzi | Waschkowski
;

matchMultivaluedNumericField
required_capability: match_function
qstrWithMultivaluedNumericField
required_capability: qstr_function

from employees
| where qstr("salary_change: [14 TO *]")
Expand All @@ -137,7 +137,7 @@ emp_no:integer | first_name:keyword | last_name:keyword | salary_change:double
;

testMultiValuedFieldWithConjunction
required_capability: match_function
required_capability: qstr_function

from employees
| where (qstr("job_positions: (Data Scientist) OR job_positions:(Support Engineer)")) and gender == "F"
Expand Down
Loading