-
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
Throw Error on deprecated nGram and edgeNGram custom filters #50376
Conversation
Pinging @elastic/es-search (:Search/Analysis) |
@@ -242,7 +244,17 @@ | |||
filters.put("dictionary_decompounder", requiresAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); | |||
filters.put("dutch_stem", DutchStemTokenFilterFactory::new); | |||
filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new); | |||
filters.put("edgeNGram", EdgeNGramTokenFilterFactory::new); | |||
filters.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { | |||
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { |
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.
Unfortunately we can only error for these cases starting with 7.6 now since there might already be existing indices <7.6 that we don't want to break on minor version upgrade. Those should at least be logging a deprecation now.
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.
Do you think we should wait until 8 because this is technically breaking? I mean, using them relies on a bug, but still.
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.
We already removed the PreConfiguredTokenFilter registration for "nGram" and "edgeNGram" in 8 (using those should have thrown errors since 7.0), but I see we still register them in getTokenFilters()
. Still we clearly documented the deprecation and removal and I think we don't mention those variants in the docs for a long time now. I think disallowing new index creation using those in 7.6 should be okay, wdyt?
I think for 8.0 this means we cannot remove the registration for these names just yet and need to forward-port this error/deprecation handling there as well unfortunately.
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 just don't want someone who does a minor upgrade to have their daily indices not get created any more.
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.
Sound like we should start logging the deprecation warning with 7.6 and throw an error on 8.0 for this then. That would only apply for this type of custom filter use left out by the original deprecation back in #30209.
I will update the PR and see if I can change the target branch so we add this on master and then backport to 7.x
@@ -242,7 +244,17 @@ | |||
filters.put("dictionary_decompounder", requiresAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); | |||
filters.put("dutch_stem", DutchStemTokenFilterFactory::new); | |||
filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new); | |||
filters.put("edgeNGram", EdgeNGramTokenFilterFactory::new); | |||
filters.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { | |||
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { |
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.
Do you think we should wait until 8 because this is technically breaking? I mean, using them relies on a bug, but still.
...alysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisPluginTests.java
Outdated
Show resolved
Hide resolved
The camel-case `nGram` and `edgeNGram` filter names were deprecated in 6. We currently throw errors on new indices when they are used. However these errors are currently only thrown for pre-configured filters, adding them as custom filters doesn't trigger the warning and error. This change adds the appropriate exceptions for `nGram` and `edgeNGram` respectively. Closes elastic#50360
@nik9000 moved the PR to target master, the deprecation part would be backported to 7.6.0. |
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. Sorry for all the trouble.
@elasticmachine update branch |
The camel-case `nGram` and `edgeNGram` filter names were deprecated in 6. We currently throw errors on new indices when they are used. However these errors are currently only thrown for pre-configured filters, adding them as custom filters doesn't trigger the warning and error. This change adds the appropriate deprecation warnings for `nGram` and `edgeNGram` respectively on version 7 indices. Relates elastic#50360
The camel-case `nGram` and `edgeNGram` filter names were deprecated in 6. We currently throw errors on new indices when they are used. However these errors are currently only thrown for pre-configured filters, adding them as custom filters doesn't trigger the warning and error. This change adds the appropriate deprecation warnings for `nGram` and `edgeNGram` respectively on version 7 indices. Relates #50360
…#50376) The camel-case `nGram` and `edgeNGram` filter names were deprecated in 6. We currently throw errors on new indices when they are used. However these errors are currently only thrown for pre-configured filters, adding them as custom filters doesn't trigger the warning and error. This change adds the appropriate exceptions for `nGram` and `edgeNGram` respectively. Closes elastic#50360
edgeNGram and NGram tokenizers and token filters were deprecated. They have not been supported in indices created from 8.0, hence their support can entirely be removed from main. The version related logic around the min grams can also be removed as it refers to 7.x which we no longer need to support. Relates to elastic#50376, elastic#50862, elastic#43568
edgeNGram and NGram tokenizers and token filters were deprecated. They have not been supported in indices created from 8.0, hence their support can entirely be removed from main. The version related logic around the min grams can also be removed as it refers to 7.x which we no longer need to support. Relates to #50376, #50862, #43568
…c#113009) edgeNGram and NGram tokenizers and token filters were deprecated. They have not been supported in indices created from 8.0, hence their support can entirely be removed from main. The version related logic around the min grams can also be removed as it refers to 7.x which we no longer need to support. Relates to elastic#50376, elastic#50862, elastic#43568
The camel-case
nGram
andedgeNGram
filter names were deprecated in 6. Wecurrently throw errors on new indices when they are used. However these errors
are currently only thrown for pre-configured filters, adding them as custom
filters doesn't trigger the warning and error. This change adds the appropriate
exceptions for
nGram
andedgeNGram
respectively.Closes #50360