From 7704d3412cfaa2bff22a84aa72b5be1fad4d84f1 Mon Sep 17 00:00:00 2001 From: liketic Date: Wed, 13 Sep 2017 19:18:51 +0800 Subject: [PATCH 1/6] Replace delimited_payload_filter by delimited_payload --- .../termvectors/GetTermVectorsTests.java | 8 ++--- .../delimited-payload-tokenfilter.asciidoc | 2 +- docs/reference/migration/migrate_7_0.asciidoc | 1 + .../migration/migrate_7_0/analysis.asciidoc | 6 ++++ .../analysis/common/CommonAnalysisPlugin.java | 7 ++++ .../common/CommonAnalysisFactoryTests.java | 2 ++ .../test/analysis-common/40_token_filters.yml | 34 +++++++++++++++++++ 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 docs/reference/migration/migrate_7_0/analysis.asciidoc diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java index 5e81949402055..3ce7dc3cd2a46 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java @@ -152,10 +152,10 @@ public void testRandomPayloadWithDelimitedPayloadTokenFilter() throws IOExceptio .field("analyzer", "payload_test").endObject().endObject().endObject().endObject(); Settings setting = Settings.builder() .put("index.analysis.analyzer.payload_test.tokenizer", "whitespace") - .putList("index.analysis.analyzer.payload_test.filter", "my_delimited_payload_filter") - .put("index.analysis.filter.my_delimited_payload_filter.delimiter", delimiter) - .put("index.analysis.filter.my_delimited_payload_filter.encoding", encodingString) - .put("index.analysis.filter.my_delimited_payload_filter.type", "mock_payload_filter").build(); + .putList("index.analysis.analyzer.payload_test.filter", "my_delimited_payload") + .put("index.analysis.filter.my_delimited_payload.delimiter", delimiter) + .put("index.analysis.filter.my_delimited_payload.encoding", encodingString) + .put("index.analysis.filter.my_delimited_payload.type", "mock_payload_filter").build(); createIndex("test", setting, "type1", mapping); client().prepareIndex("test", "type1", Integer.toString(1)) diff --git a/docs/reference/analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc index b64f5edbeb94c..f50eb2fdd05cc 100644 --- a/docs/reference/analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc @@ -1,7 +1,7 @@ [[analysis-delimited-payload-tokenfilter]] === Delimited Payload Token Filter -Named `delimited_payload_filter`. Splits tokens into tokens and payload whenever a delimiter character is found. +Named `delimited_payload`. Splits tokens into tokens and payload whenever a delimiter character is found. Example: "the|1 quick|2 fox|3" is split by default into tokens `the`, `quick`, and `fox` with payloads `1`, `2`, and `3` respectively. diff --git a/docs/reference/migration/migrate_7_0.asciidoc b/docs/reference/migration/migrate_7_0.asciidoc index 043d62465be39..f6c695e1051b0 100644 --- a/docs/reference/migration/migrate_7_0.asciidoc +++ b/docs/reference/migration/migrate_7_0.asciidoc @@ -30,6 +30,7 @@ way to reindex old indices is to use the `reindex` API. * <> * <> * <> +* <> include::migrate_7_0/aggregations.asciidoc[] include::migrate_7_0/cluster.asciidoc[] diff --git a/docs/reference/migration/migrate_7_0/analysis.asciidoc b/docs/reference/migration/migrate_7_0/analysis.asciidoc new file mode 100644 index 0000000000000..3d92168e2cd87 --- /dev/null +++ b/docs/reference/migration/migrate_7_0/analysis.asciidoc @@ -0,0 +1,6 @@ +[[breaking_70_analysis_changes]] +=== Analysis changes + +==== The `delimited_payload_filter` is deprecated + +The `delimited_payload_filter` is deprecated and should be replaced by `delimited_payload`. diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index 813075fa73f06..ae3fda6727990 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -103,7 +103,9 @@ public Map> getTokenFilters() { filters.put("czech_stem", CzechStemTokenFilterFactory::new); filters.put("common_grams", requriesAnalysisSettings(CommonGramsTokenFilterFactory::new)); filters.put("decimal_digit", DecimalDigitFilterFactory::new); + // TODO deprecate delimited_payload_filter filters.put("delimited_payload_filter", DelimitedPayloadTokenFilterFactory::new); + filters.put("delimited_payload", DelimitedPayloadTokenFilterFactory::new); filters.put("dictionary_decompounder", requriesAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); filters.put("dutch_stem", DutchStemTokenFilterFactory::new); filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new); @@ -191,10 +193,15 @@ public List getPreConfiguredTokenFilters() { input -> new CommonGramsFilter(input, CharArraySet.EMPTY_SET))); filters.add(PreConfiguredTokenFilter.singleton("czech_stem", false, CzechStemFilter::new)); filters.add(PreConfiguredTokenFilter.singleton("decimal_digit", true, DecimalDigitFilter::new)); + // TODO deprecate delimited_payload_filter filters.add(PreConfiguredTokenFilter.singleton("delimited_payload_filter", false, input -> new DelimitedPayloadTokenFilter(input, DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER, DelimitedPayloadTokenFilterFactory.DEFAULT_ENCODER))); + filters.add(PreConfiguredTokenFilter.singleton("delimited_payload", false, input -> + new DelimitedPayloadTokenFilter(input, + DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER, + DelimitedPayloadTokenFilterFactory.DEFAULT_ENCODER))); filters.add(PreConfiguredTokenFilter.singleton("dutch_stem", false, input -> new SnowballFilter(input, new DutchStemmer()))); filters.add(PreConfiguredTokenFilter.singleton("edge_ngram", false, input -> new EdgeNGramTokenFilter(input, EdgeNGramTokenFilter.DEFAULT_MIN_GRAM_SIZE, EdgeNGramTokenFilter.DEFAULT_MAX_GRAM_SIZE))); diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java index 707930277e7a2..ce9cd8cb4931b 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java @@ -169,7 +169,9 @@ protected Map> getPreConfiguredTokenFilters() { filters.put("common_grams", null); filters.put("czech_stem", null); filters.put("decimal_digit", null); + // TODO deprecate delimited_payload_filter filters.put("delimited_payload_filter", org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilterFactory.class); + filters.put("delimited_payload", org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilterFactory.class); filters.put("dutch_stem", SnowballPorterFilterFactory.class); filters.put("edge_ngram", null); filters.put("edgeNGram", null); diff --git a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml index 47eb436788abf..93de10e93a8e2 100644 --- a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml +++ b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml @@ -1026,6 +1026,7 @@ - match: { tokens.10.token: ちた } --- +# Deprecate delimited_payload_filter "delimited_payload_filter": - do: indices.create: @@ -1058,6 +1059,39 @@ - length: { tokens: 1 } - match: { tokens.0.token: foo } +--- +"delimited_payload": + - do: + indices.create: + index: test + body: + settings: + analysis: + filter: + my_delimited_payload: + type: delimited_payload + delimiter: ^ + encoding: identity + - do: + indices.analyze: + index: test + body: + text: foo^bar + tokenizer: keyword + filter: [my_delimited_payload] + - length: { tokens: 1 } + - match: { tokens.0.token: foo } + + # Test pre-configured token filter too: + - do: + indices.analyze: + body: + text: foo|5 + tokenizer: keyword + filter: [delimited_payload] + - length: { tokens: 1 } + - match: { tokens.0.token: foo } + --- "keep_filter": - do: From 7e7c54dce07cb806477e34ff81f2b46ea87edfb3 Mon Sep 17 00:00:00 2001 From: liketic Date: Thu, 2 Nov 2017 20:46:34 +0800 Subject: [PATCH 2/6] Add deprecation log for delimited_payload_filter --- .../index/analysis/AnalysisRegistry.java | 10 ++++++++-- .../analysis/common/CommonAnalysisPlugin.java | 1 - .../analysis/common/CommonAnalysisFactoryTests.java | 1 - .../test/analysis-common/40_token_filters.yml | 12 +++++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java index 2e5be06347721..7a556ce43ddca 100644 --- a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java +++ b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; @@ -42,7 +41,6 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -53,6 +51,8 @@ * This class exists per node and allows to create per-index {@link IndexAnalyzers} via {@link #build(IndexSettings)} */ public final class AnalysisRegistry implements Closeable { + private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(AnalysisRegistry.class)); + public static final String INDEX_ANALYSIS_CHAR_FILTER = "index.analysis.char_filter"; public static final String INDEX_ANALYSIS_FILTER = "index.analysis.filter"; public static final String INDEX_ANALYSIS_TOKENIZER = "index.analysis.tokenizer"; @@ -384,6 +384,9 @@ private AnalysisProvider getAnalysisProvider(Component component, Map type = providerMap.get(typeName); if (type == null) { throw new IllegalArgumentException("Unknown " + component + " type [" + typeName + "] for [" + name + "]"); @@ -421,6 +424,9 @@ public AnalysisModule.AnalysisProvider getCharFilterFactory(S } public AnalysisModule.AnalysisProvider getTokenFilterFactory(String name) { + if ("delimited_payload_filter".equals(name)) { + DEPRECATION_LOGGER.deprecated("Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); + } return preConfiguredTokenFilters.get(name); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index ae3fda6727990..a1ccc5b62c85d 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -103,7 +103,6 @@ public Map> getTokenFilters() { filters.put("czech_stem", CzechStemTokenFilterFactory::new); filters.put("common_grams", requriesAnalysisSettings(CommonGramsTokenFilterFactory::new)); filters.put("decimal_digit", DecimalDigitFilterFactory::new); - // TODO deprecate delimited_payload_filter filters.put("delimited_payload_filter", DelimitedPayloadTokenFilterFactory::new); filters.put("delimited_payload", DelimitedPayloadTokenFilterFactory::new); filters.put("dictionary_decompounder", requriesAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java index ce9cd8cb4931b..5113f8a6eb492 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisFactoryTests.java @@ -169,7 +169,6 @@ protected Map> getPreConfiguredTokenFilters() { filters.put("common_grams", null); filters.put("czech_stem", null); filters.put("decimal_digit", null); - // TODO deprecate delimited_payload_filter filters.put("delimited_payload_filter", org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilterFactory.class); filters.put("delimited_payload", org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilterFactory.class); filters.put("dutch_stem", SnowballPorterFilterFactory.class); diff --git a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml index 93de10e93a8e2..3738e316b71d0 100644 --- a/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml +++ b/modules/analysis-common/src/test/resources/rest-api-spec/test/analysis-common/40_token_filters.yml @@ -1026,9 +1026,15 @@ - match: { tokens.10.token: ちた } --- -# Deprecate delimited_payload_filter "delimited_payload_filter": + - skip: + version: " - 6.99.99" + reason: delimited_payload_filter deprecated in 7.0, replaced by delimited_payload + features: "warnings" + - do: + warnings: + - "Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]" indices.create: index: test body: @@ -1040,6 +1046,8 @@ delimiter: ^ encoding: identity - do: + warnings: + - "Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]" indices.analyze: index: test body: @@ -1051,6 +1059,8 @@ # Test pre-configured token filter too: - do: + warnings: + - "Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]" indices.analyze: body: text: foo|5 From 706955c351895006d718df495084840ae12acd82 Mon Sep 17 00:00:00 2001 From: liketic Date: Sat, 18 Nov 2017 18:40:42 +0800 Subject: [PATCH 3/6] Add a wrapper of token filter factory for delimited_payload_filter --- .../index/analysis/AnalysisRegistry.java | 9 +---- .../analysis/common/CommonAnalysisPlugin.java | 3 +- ...mitedPayloadTokenFilterFactoryWrapper.java | 38 +++++++++++++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java diff --git a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java index 7a556ce43ddca..15143a244f1c3 100644 --- a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java +++ b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java @@ -51,8 +51,6 @@ * This class exists per node and allows to create per-index {@link IndexAnalyzers} via {@link #build(IndexSettings)} */ public final class AnalysisRegistry implements Closeable { - private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(AnalysisRegistry.class)); - public static final String INDEX_ANALYSIS_CHAR_FILTER = "index.analysis.char_filter"; public static final String INDEX_ANALYSIS_FILTER = "index.analysis.filter"; public static final String INDEX_ANALYSIS_TOKENIZER = "index.analysis.tokenizer"; @@ -305,6 +303,7 @@ public String toString() { }; } + @SuppressWarnings("unchecked") private Map buildMapping(Component component, IndexSettings settings, Map settingsMap, Map> providerMap, Map> defaultInstance) throws IOException { @@ -384,9 +383,6 @@ private AnalysisProvider getAnalysisProvider(Component component, Map type = providerMap.get(typeName); if (type == null) { throw new IllegalArgumentException("Unknown " + component + " type [" + typeName + "] for [" + name + "]"); @@ -424,9 +420,6 @@ public AnalysisModule.AnalysisProvider getCharFilterFactory(S } public AnalysisModule.AnalysisProvider getTokenFilterFactory(String name) { - if ("delimited_payload_filter".equals(name)) { - DEPRECATION_LOGGER.deprecated("Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); - } return preConfiguredTokenFilters.get(name); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index a1ccc5b62c85d..a1def96874c8e 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -103,7 +103,7 @@ public Map> getTokenFilters() { filters.put("czech_stem", CzechStemTokenFilterFactory::new); filters.put("common_grams", requriesAnalysisSettings(CommonGramsTokenFilterFactory::new)); filters.put("decimal_digit", DecimalDigitFilterFactory::new); - filters.put("delimited_payload_filter", DelimitedPayloadTokenFilterFactory::new); + filters.put("delimited_payload_filter", DelimitedPayloadTokenFilterFactoryWrapper::new); filters.put("delimited_payload", DelimitedPayloadTokenFilterFactory::new); filters.put("dictionary_decompounder", requriesAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); filters.put("dutch_stem", DutchStemTokenFilterFactory::new); @@ -192,7 +192,6 @@ public List getPreConfiguredTokenFilters() { input -> new CommonGramsFilter(input, CharArraySet.EMPTY_SET))); filters.add(PreConfiguredTokenFilter.singleton("czech_stem", false, CzechStemFilter::new)); filters.add(PreConfiguredTokenFilter.singleton("decimal_digit", true, DecimalDigitFilter::new)); - // TODO deprecate delimited_payload_filter filters.add(PreConfiguredTokenFilter.singleton("delimited_payload_filter", false, input -> new DelimitedPayloadTokenFilter(input, DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER, diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java new file mode 100644 index 0000000000000..9cf6cc10a4b38 --- /dev/null +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java @@ -0,0 +1,38 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.analysis.common; + +import org.elasticsearch.Version; +import org.elasticsearch.common.logging.DeprecationLogger; +import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.env.Environment; +import org.elasticsearch.index.IndexSettings; + +public class DelimitedPayloadTokenFilterFactoryWrapper extends DelimitedPayloadTokenFilterFactory { + private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(DelimitedPayloadTokenFilterFactoryWrapper.class)); + + DelimitedPayloadTokenFilterFactoryWrapper(IndexSettings indexSettings, Environment env, String name, Settings settings) { + super(indexSettings, env, name, settings); + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + DEPRECATION_LOGGER.deprecated("Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); + } + } +} From 194d56c54d5b32cb7facea96bc06d23cc90afc84 Mon Sep 17 00:00:00 2001 From: liketic Date: Wed, 22 Nov 2017 16:10:06 +0800 Subject: [PATCH 4/6] Fix naming of legacy delimited payload filter factory class --- .../elasticsearch/analysis/common/CommonAnalysisPlugin.java | 2 +- ...r.java => LegacyDelimitedPayloadTokenFilterFactory.java} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/{DelimitedPayloadTokenFilterFactoryWrapper.java => LegacyDelimitedPayloadTokenFilterFactory.java} (82%) diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index a1def96874c8e..6f47ad5f77096 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -103,7 +103,7 @@ public Map> getTokenFilters() { filters.put("czech_stem", CzechStemTokenFilterFactory::new); filters.put("common_grams", requriesAnalysisSettings(CommonGramsTokenFilterFactory::new)); filters.put("decimal_digit", DecimalDigitFilterFactory::new); - filters.put("delimited_payload_filter", DelimitedPayloadTokenFilterFactoryWrapper::new); + filters.put("delimited_payload_filter", LegacyDelimitedPayloadTokenFilterFactory::new); filters.put("delimited_payload", DelimitedPayloadTokenFilterFactory::new); filters.put("dictionary_decompounder", requriesAnalysisSettings(DictionaryCompoundWordTokenFilterFactory::new)); filters.put("dutch_stem", DutchStemTokenFilterFactory::new); diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java similarity index 82% rename from modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java rename to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java index 9cf6cc10a4b38..e00d4a4186841 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/DelimitedPayloadTokenFilterFactoryWrapper.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java @@ -26,10 +26,10 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; -public class DelimitedPayloadTokenFilterFactoryWrapper extends DelimitedPayloadTokenFilterFactory { - private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(DelimitedPayloadTokenFilterFactoryWrapper.class)); +public class LegacyDelimitedPayloadTokenFilterFactory extends DelimitedPayloadTokenFilterFactory { + private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(LegacyDelimitedPayloadTokenFilterFactory.class)); - DelimitedPayloadTokenFilterFactoryWrapper(IndexSettings indexSettings, Environment env, String name, Settings settings) { + LegacyDelimitedPayloadTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, env, name, settings); if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { DEPRECATION_LOGGER.deprecated("Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); From d3e6cfbba7972f0ea0a3145b4768ce8711ff0351 Mon Sep 17 00:00:00 2001 From: liketic Date: Wed, 22 Nov 2017 20:36:46 +0800 Subject: [PATCH 5/6] Update document wording --- docs/reference/migration/migrate_7_0/analysis.asciidoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/reference/migration/migrate_7_0/analysis.asciidoc b/docs/reference/migration/migrate_7_0/analysis.asciidoc index 3d92168e2cd87..9a1b0aecd599d 100644 --- a/docs/reference/migration/migrate_7_0/analysis.asciidoc +++ b/docs/reference/migration/migrate_7_0/analysis.asciidoc @@ -1,6 +1,8 @@ [[breaking_70_analysis_changes]] === Analysis changes -==== The `delimited_payload_filter` is deprecated +==== The `delimited_payload_filter` is renamed -The `delimited_payload_filter` is deprecated and should be replaced by `delimited_payload`. +The `delimited_payload_filter` is renamed to `delimited_payload`, the old name is +deprecated and will be removed at some point, so it should be replaced by +`delimited_payload`. From f1d33f29ab478b0139e693bd5c4b7c5640ffe90d Mon Sep 17 00:00:00 2001 From: liketic Date: Thu, 23 Nov 2017 22:38:05 +0800 Subject: [PATCH 6/6] Fix code style --- .../common/LegacyDelimitedPayloadTokenFilterFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java index e00d4a4186841..d4ecee4b90b01 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java @@ -27,7 +27,8 @@ import org.elasticsearch.index.IndexSettings; public class LegacyDelimitedPayloadTokenFilterFactory extends DelimitedPayloadTokenFilterFactory { - private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(LegacyDelimitedPayloadTokenFilterFactory.class)); + private static final DeprecationLogger DEPRECATION_LOGGER = + new DeprecationLogger(Loggers.getLogger(LegacyDelimitedPayloadTokenFilterFactory.class)); LegacyDelimitedPayloadTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, env, name, settings);