Skip to content

Conversation

romseygeek
Copy link
Contributor

Companion issue to #31060 for the 6.x branch. Instead of throwing an exception, a deprecation warning is logged and a MatchNoDocsQuery is returned.

@romseygeek romseygeek added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types >deprecation v6.4.0 labels Jun 4, 2018
@romseygeek romseygeek self-assigned this Jun 4, 2018
@romseygeek romseygeek requested a review from jimczi June 4, 2018 13:43
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

Maybe we should move the phraseQuery factory method to StringFieldType rather than TextFieldType so that phrase queries on keyword fields keep failing the same way as before?


public Query multiPhraseQuery(String field, TokenStream stream, int slop, boolean enablePositionIncrements) throws IOException {
throw new IllegalArgumentException("Can only use phrase queries on text fields - not on [" + name + "] which is of type [" + typeName() + "]");
public Query multiPhraseQuery(String field, TokenStream stream, int slop, boolean enablePositionIncrements,
Copy link
Contributor

Choose a reason for hiding this comment

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

we could use a static deprecation logger instead of requiring callers to pass one?

@romseygeek
Copy link
Contributor Author

I think phrase queries on keyword fields will still fail in the same way? They'll get passed through to MatchQuery which will throw an exception because there are no positions indexed.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

If that's the case then LGTM. Thanks @romseygeek.

@romseygeek
Copy link
Contributor Author

@elasticmachine retest this please

@jimczi
Copy link
Contributor

jimczi commented Jun 5, 2018

run gradle build tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>deprecation >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v6.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants