-
Notifications
You must be signed in to change notification settings - Fork 25.5k
ES|QL: Allow simplified full text search using text in where clause #135264
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
base: main
Are you sure you want to change the base?
Conversation
… into esql-simpler-full-text-function
Expression condition = filter.condition(); | ||
|
||
// Replace every instance of FullTextSearch | ||
if (condition instanceof FullTextSearch fts) { |
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.
Alternatively we could check, if MultiMatch
contains one field, which is an instance of UnresolvedStar
instead of introducing a separate "marker class" FullTextSearch
.
|
||
if (condition instanceof MultiMatch multiMatch && multiMatch.fields().size() == 1) { | ||
// MULTI_MATCH and MATCH have a subset of common options | ||
Expression filteredOptions = filterOptionsForMatch(multiMatch.options()); |
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.
Will add a test making sure options are passed correctly from MultiMatch
to Match
Summary
This PR adds a simplified way of doing a full-text-search over all text fields in an index using ES|QL.
The new syntax looks like the following:
instead of:
This functionality inherits the underlying restrictions of
multi_match
(not working withsemantic_text
out of the box). I've intentionally decided against handling edge cases like raising errors, when multiple text fields, which include one or moresemantic_text
fields, are queried as this should probably be the responsibility of themulti_match
function itself. It would also be not too straightforward as the information, if a text field is of typesemantic_text
is not known in the analysis/verification phase, but only during physical optimization AFAIU. It felt wrong to hack this into earlier phases of query processing, but happy to discuss more - could've missed something of course :)Querying a single
semantic_text
field works as the query will be translated to useMATCH
instead ofMULTI_MATCH
, if only one text (includingsemantic_text
) field is present in the queried index.Requests for testing:
Create index with multiple text fields:
Indexing sample data:
Normal multi-match ES|QL search:
New simplified ES|QL full-text-search: