-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Make intervals queries fully pluggable through field mappers. #71429
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
Make intervals queries fully pluggable through field mappers. #71429
Conversation
`MappedFieldType` only allows configuring `match` and `prefix` queries today. This change makes it possible to configure how to create `wildcard` and `fuzzy` queries as well. This will allow making the upcoming `match_only_text` field fully support intervals queries.
Pinging @elastic/es-search (Team:Search) |
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.
I left a minor comment, LGTM otherwise
if (useField != null) { | ||
source = Intervals.fixField(useField, source); | ||
} | ||
return source; | ||
} | ||
|
||
private void checkPositions(MappedFieldType type) { |
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.
Should we change the check to still throw a comprehensive exception when positions are not available on the field ?
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.
The check has moved to TextFieldType
so that things would still work with MatchOnlyTextFieldMapper
which doesn't index positions but computes them on the fly. Does it address your question?
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.
ah right I skipped that part. Thanks, that addresses my question.
I wonder if rather than having four intervals methods on MappedFieldType, we could merge things down to a single We can probably just remove all the checkPositions() calls as well, tbh, as there will be a check within IntervalQuery itself so I'm not sure this additional verification is useful. |
No strong feelings but I like that we're failing early at query parsing time this way, while we'd otherwise fail when creating the scorer. In the prefix case when we delegate to the prefix field type, it also helps have the message about the right field name (ie. not the field name of the sub prefix field). |
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.
LGTM, thanks @jpountz
`MappedFieldType` only allows configuring `match` and `prefix` queries today. This change makes it possible to configure how to create `wildcard` and `fuzzy` queries as well. This will allow making the upcoming `match_only_text` field fully support intervals queries.
MappedFieldType
only allows configuringmatch
andprefix
queries today.This change makes it possible to configure how to create
wildcard
andfuzzy
queries as well.
This will allow making the upcoming
match_only_text
field fully supportintervals queries.