-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Clarify what query components cross_fields supports #68795
Conversation
This refactor isn't high priority on its own, since we don't touch |
@@ -184,15 +205,7 @@ protected Query newTermQuery(Term term, float boost) { | |||
|
|||
@Override | |||
protected Query newPrefixQuery(Term term) { |
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.
A couple notes:
- Although the
cross_fields
query doesn't allow phrases, theanalyzePhrase
method must be implemented to support multi-word synonyms withauto_generate_synonyms_phrase_query: true
. - I think we can remove
analyzeMultiPhrase
. This method supports phrase queries that contain a term with synonyms, which should never occur withcross_fields
. I opted not to remove it since the logic is tricky and I didn't want to risk a regression when we aim to deprecatecross_fields
anyways.
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, nice cleanup
Pinging @elastic/es-search (Team:Search) |
When backporting #68795, we introduced a regression around `match` queries on field aliases. If the `match` query parses to a `synonym` query (because its analyzer can produce multiple tokens at a single position), then we don't resolve the field alias to its concrete field. This means the query will not have any results. We already had a test for this case but it was too narrow. Note this regression only affects 7.x, there is no bug on master.
When backporting #68795, we introduced a regression around `match` queries on field aliases. If the `match` query parses to a `synonym` query (because its analyzer can produce multiple tokens at a single position), then we don't resolve the field alias to its concrete field. This means the query will not have any results. We already had a test for this case but it was too narrow. Note this regression only affects 7.x, there is no bug on master.
When backporting #68795, we introduced a regression around `match` queries on field aliases. If the `match` query parses to a `synonym` query (because its analyzer can produce multiple tokens at a single position), then we don't resolve the field alias to its concrete field. This means the query will not have any results. We already had a test for this case but it was too narrow. Note this regression only affects 7.x, there is no bug on master.
The parsing logic for the
cross_fields
mode was very general, making it hardto tell what query components it actually supports. This PR clarifies that only
'bag of words' queries are supported, it does not accept phrase or prefix
queries. It also renames
BlendedQueryBuilder
->CrossFieldsQueryBuilder
forclarity.