- Notifications
You must be signed in to change notification settings - Fork 25.6k
Add ESQL match function #113374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ESQL match function #113374
Changes from all commits
ab5852c 35573a3 b2fc887 fdbd226 e4c1fbe 9c93412 f48d648 58e1eee 242d993 11b59f0 0acd604 7957382 3b28cc9 c9449c7 1fa0c60 f88bf30 880b4e6 5718d68 e23eef3 862374d f9371b1 0a05d5b 6601dfa dd6df12 16d88b0 9e32c8e 3297ea5 953b276 2877688 274c94f a468d46 a0f2c7d d1c0978 cde3411 f21e7bc c1bc3be 3027f2c 9fcb0ac 1358ef7 a9d6d3c b19751e 9762245 0cf99be 8760992 67a9fb0 a976d2c 1ceee62 41dc6d3 5a8a4f5 79cd897 7851172 e444978 70ad4b0 1380c70 fedefce 1c500dd dcc8bf6 8b646a8 b97aaf6 fc58631 97a6cf8 2e3e0a0 e5ce220 71be479 42fb0ce 1f228d2 233528d 98db692 5f31399 9dac2c6 3aa66af 44b2f33 141ddda a25db90 419b8fb 80311e2 22b009e c433aa1 2200f4d deb539b e27c112 c803d1b 75161bb cc32930 2ddcbb5 87dcd7f 19f0546 06f2eaf 097c8f7 b1ed0db 7ed7975 96fe431 c5a26e6 e4cb62c 11cdb85 937ddf1 871cb02 2ff3ec5 43d2463 0dd782c d4e6256 03a0246 87807ed 2e5ce4e 0045703 3c0c3be 38a6136 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 113374 | ||
| summary: Add ESQL match function | ||
| area: ES|QL | ||
| type: feature | ||
| issues: [] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| ############################################### | ||
| # Tests for Match function | ||
| # | ||
| | ||
| matchWithField | ||
| required_capability: match_function | ||
| | ||
| // tag::match-with-field[] | ||
| from books | ||
carlosdelest marked this conversation as resolved. Show resolved Hide resolved | ||
| | where match(author, "Faulkner") | ||
| | keep book_no, author | ||
| | sort book_no | ||
| | limit 5; | ||
| // end::match-with-field[] | ||
| | ||
| // tag::match-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::match-with-field-result[] | ||
| | ||
| matchWithMultipleFunctions | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | where match(title, "Return") AND match(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 | ||
| ; | ||
| | ||
| matchWithQueryExpressions | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | where match(title, CONCAT("Return ", " King")) | ||
| | 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 | ||
| ; | ||
| | ||
| matchAfterKeep | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | keep book_no, author | ||
| | where match(author, "Faulkner") | ||
| | sort book_no | ||
| | limit 5; | ||
| | ||
| 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 | ||
| ; | ||
| | ||
| matchAfterDrop | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | drop ratings, description, year, publisher, title, author.keyword | ||
| | where match(author, "Faulkner") | ||
| | keep book_no, author | ||
| | sort book_no | ||
| | limit 5; | ||
| | ||
| 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 | ||
| ; | ||
| | ||
| matchAfterEval | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | eval stars = to_long(ratings / 2.0) | ||
| | where match(author, "Faulkner") | ||
| | sort book_no | ||
| | keep book_no, author, stars | ||
| | limit 5; | ||
| | ||
| book_no:keyword | author:text | stars:long | ||
| 2378 | [Carol Faulkner, Holly Byers Ochoa, Lucretia Mott] | 3 | ||
| 2713 | William Faulkner | 2 | ||
| 2847 | Colleen Faulkner | 3 | ||
| 2883 | William Faulkner | 2 | ||
| 3293 | Danny Faulkner | 2 | ||
| ; | ||
| | ||
| matchWithConjunction | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | where match(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) | ||
| ; | ||
| | ||
| matchWithFunctionPushedToLucene | ||
| required_capability: match_function | ||
| | ||
| from hosts | ||
| | where match(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 | ||
| ; | ||
| | ||
| matchWithNonPushableConjunction | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | where match(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 | ||
| ; | ||
| | ||
| matchWithMultipleWhereClauses | ||
| required_capability: match_function | ||
| | ||
| from books | ||
| | where match(title, "rings") | ||
| | where match(title, "lord") | ||
| | keep book_no, title; | ||
| ignoreOrder:true | ||
| | ||
| book_no:keyword | title:text | ||
| 2675 | The Lord of the Rings - Boxed Set | ||
| 2714 | Return of the King Being the Third Part of The Lord of the Rings | ||
| 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) | ||
| ; | ||
| | ||
| matchMultivaluedField | ||
| required_capability: match_function | ||
| | ||
| from employees | ||
| | where match(job_positions, "Tech Lead") and match(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 | ||
| ; | ||
| | ||
| testMultiValuedFieldWithConjunction | ||
| required_capability: match_function | ||
| | ||
| from employees | ||
| | where match(job_positions, "Data Scientist") and match(job_positions, "Support Engineer") | ||
| | keep emp_no, first_name, last_name; | ||
| ignoreOrder:true | ||
| | ||
| emp_no:integer | first_name:keyword | last_name:keyword | ||
| 10043 | Yishay | Tzvieli | ||
| ; | ||
| | ||
| testMatchAndQueryStringFunctions | ||
| required_capability: match_function | ||
| required_capability: qstr_function | ||
| | ||
| from employees | ||
| | where match(job_positions, "Data Scientist") and qstr("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 | ||
| 10041 | Uri | Lenart | ||
| 10043 | Yishay | Tzvieli | ||
| ; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
isNotFoldable()method as it was unused, and createdisNotNull()