Introduce deprecation categories (#68061)

Sort-of backport of #67443.

Closes #64824. Introduce the concept of categories to deprecation
logging. Every location where we log a deprecation message must now
include a deprecation category.
This commit is contained in:
Rory Hunter 2021-01-29 14:31:13 +00:00 committed by GitHub
parent 6c8ed22e95
commit 1c5b89c89d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
172 changed files with 612 additions and 313 deletions

View file

@ -23,6 +23,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.cjk.CJKBigramFilter; import org.apache.lucene.analysis.cjk.CJKBigramFilter;
import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute; import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -102,7 +103,7 @@ public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
"] cannot be used to parse synonyms"); "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name()
+ "] will not be usable to parse synonyms after v7.0"); + "] will not be usable to parse synonyms after v7.0");
} }
} }

View file

@ -116,6 +116,7 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -249,7 +250,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
filters.put("dutch_stem", DutchStemTokenFilterFactory::new); filters.put("dutch_stem", DutchStemTokenFilterFactory::new);
filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new); filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new);
filters.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { filters.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
deprecationLogger.deprecate("edgeNGram_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation",
"The [edgeNGram] token filter name is deprecated and will be removed in a future version. " "The [edgeNGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [edge_ngram] instead."); + "Please change the filter name to [edge_ngram] instead.");
return new EdgeNGramTokenFilterFactory(indexSettings, environment, name, settings); return new EdgeNGramTokenFilterFactory(indexSettings, environment, name, settings);
@ -274,7 +275,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
filters.put("multiplexer", MultiplexerTokenFilterFactory::new); filters.put("multiplexer", MultiplexerTokenFilterFactory::new);
filters.put("ngram", NGramTokenFilterFactory::new); filters.put("ngram", NGramTokenFilterFactory::new);
filters.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { filters.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
deprecationLogger.deprecate("nGram_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_deprecation",
"The [nGram] token filter name is deprecated and will be removed in a future version. " "The [nGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [ngram] instead."); + "Please change the filter name to [ngram] instead.");
return new NGramTokenFilterFactory(indexSettings, environment, name, settings); return new NGramTokenFilterFactory(indexSettings, environment, name, settings);
@ -323,7 +324,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
tokenizers.put("thai", ThaiTokenizerFactory::new); tokenizers.put("thai", ThaiTokenizerFactory::new);
tokenizers.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { tokenizers.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.deprecate("nGram_tokenizer_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. " "The [nGram] tokenizer name is deprecated and will be removed in a future version. "
+ "Please change the tokenizer name to [ngram] instead."); + "Please change the tokenizer name to [ngram] instead.");
} }
@ -332,7 +333,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
tokenizers.put("ngram", NGramTokenizerFactory::new); tokenizers.put("ngram", NGramTokenizerFactory::new);
tokenizers.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> { tokenizers.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.deprecate("edgeNGram_tokenizer_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation",
"The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. " "The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. "
+ "Please change the tokenizer name to [edge_ngram] instead."); + "Please change the tokenizer name to [edge_ngram] instead.");
} }
@ -413,7 +414,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
filters.add(PreConfiguredCharFilter.singleton("html_strip", false, HTMLStripCharFilter::new)); filters.add(PreConfiguredCharFilter.singleton("html_strip", false, HTMLStripCharFilter::new));
filters.add(PreConfiguredCharFilter.elasticsearchVersion("htmlStrip", false, (reader, version) -> { filters.add(PreConfiguredCharFilter.elasticsearchVersion("htmlStrip", false, (reader, version) -> {
if (version.onOrAfter(org.elasticsearch.Version.V_6_3_0)) { if (version.onOrAfter(org.elasticsearch.Version.V_6_3_0)) {
deprecationLogger.deprecate("htmlStrip_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "htmlStrip_deprecation",
"The [htmpStrip] char filter name is deprecated and will be removed in a future version. " "The [htmpStrip] char filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [html_strip] instead."); + "Please change the filter name to [html_strip] instead.");
} }
@ -444,7 +445,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
"[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead"); "[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead");
} }
if (version.onOrAfter(Version.V_6_2_0)) { if (version.onOrAfter(Version.V_6_2_0)) {
deprecationLogger.deprecate("analysis_delimited_payload_filter", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "analysis_delimited_payload_filter",
"Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); "Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]");
} }
return new DelimitedPayloadTokenFilter(input, return new DelimitedPayloadTokenFilter(input,
@ -464,7 +465,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
"The [edgeNGram] token filter name was deprecated in 6.4 and cannot be used in new indices. " "The [edgeNGram] token filter name was deprecated in 6.4 and cannot be used in new indices. "
+ "Please change the filter name to [edge_ngram] instead."); + "Please change the filter name to [edge_ngram] instead.");
} else { } else {
deprecationLogger.deprecate("edgeNGram_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation",
"The [edgeNGram] token filter name is deprecated and will be removed in a future version. " "The [edgeNGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [edge_ngram] instead."); + "Please change the filter name to [edge_ngram] instead.");
} }
@ -491,7 +492,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
throw new IllegalArgumentException("The [nGram] token filter name was deprecated in 6.4 and cannot be used in new indices. " throw new IllegalArgumentException("The [nGram] token filter name was deprecated in 6.4 and cannot be used in new indices. "
+ "Please change the filter name to [ngram] instead."); + "Please change the filter name to [ngram] instead.");
} else { } else {
deprecationLogger.deprecate("nGram_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_deprecation",
"The [nGram] token filter name is deprecated and will be removed in a future version. " "The [nGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [ngram] instead."); + "Please change the filter name to [ngram] instead.");
} }
@ -569,7 +570,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
// Temporary shim for aliases. TODO deprecate after they are moved // Temporary shim for aliases. TODO deprecate after they are moved
tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("nGram", (version) -> { tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("nGram", (version) -> {
if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) { if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.deprecate("nGram_tokenizer_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. " "The [nGram] tokenizer name is deprecated and will be removed in a future version. "
+ "Please change the tokenizer name to [ngram] instead."); + "Please change the tokenizer name to [ngram] instead.");
} }
@ -577,7 +578,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
})); }));
tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("edgeNGram", (version) -> { tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("edgeNGram", (version) -> {
if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) { if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.deprecate("edgeNGram_tokenizer_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation",
"The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. " "The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. "
+ "Please change the tokenizer name to [edge_ngram] instead."); + "Please change the tokenizer name to [edge_ngram] instead.");
} }

View file

@ -24,6 +24,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.commongrams.CommonGramsFilter; import org.apache.lucene.analysis.commongrams.CommonGramsFilter;
import org.apache.lucene.analysis.commongrams.CommonGramsQueryFilter; import org.apache.lucene.analysis.commongrams.CommonGramsQueryFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -69,7 +70,7 @@ public class CommonGramsTokenFilterFactory extends AbstractTokenFilterFactory {
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} else { } else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name()
+ "] will not be usable to parse synonyms after v7.0"); + "] will not be usable to parse synonyms after v7.0");
} }

View file

@ -23,6 +23,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter; import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter;
import org.apache.lucene.analysis.reverse.ReverseStringFilter; import org.apache.lucene.analysis.reverse.ReverseStringFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -91,8 +92,8 @@ public class EdgeNGramTokenFilterFactory extends AbstractTokenFilterFactory {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
} }

View file

@ -22,6 +22,7 @@ package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.FingerprintFilter; import org.apache.lucene.analysis.miscellaneous.FingerprintFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -58,7 +59,7 @@ public class FingerprintTokenFilterFactory extends AbstractTokenFilterFactory {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name()
+ "] will not be usable to parse synonyms after v7.0"); + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }

View file

@ -20,6 +20,7 @@
package org.elasticsearch.analysis.common; package org.elasticsearch.analysis.common;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -37,7 +38,7 @@ public class LegacyDelimitedPayloadTokenFilterFactory extends DelimitedPayloadTo
"[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead"); "[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead");
} }
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_6_2_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_6_2_0)) {
deprecationLogger.deprecate("analysis_legacy_delimited_payload_filter", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "analysis_legacy_delimited_payload_filter",
"Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]"); "Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]");
} }
} }

View file

@ -26,6 +26,7 @@ import org.apache.lucene.analysis.miscellaneous.RemoveDuplicatesTokenFilter;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -66,8 +67,8 @@ public class MultiplexerTokenFilterFactory extends AbstractTokenFilterFactory {
} }
else { else {
if (preserveOriginal) { if (preserveOriginal) {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return IDENTITY_FILTER; return IDENTITY_FILTER;
} }
throw new IllegalArgumentException("Token filter [" + name() throw new IllegalArgumentException("Token filter [" + name()
@ -129,8 +130,8 @@ public class MultiplexerTokenFilterFactory extends AbstractTokenFilterFactory {
} }
else { else {
if (preserveOriginal) { if (preserveOriginal) {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return IDENTITY_FILTER; return IDENTITY_FILTER;
} }
throw new IllegalArgumentException("Token filter [" + name() throw new IllegalArgumentException("Token filter [" + name()

View file

@ -22,6 +22,7 @@ package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ngram.NGramTokenFilter; import org.apache.lucene.analysis.ngram.NGramTokenFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -52,7 +53,7 @@ public class NGramTokenFilterFactory extends AbstractTokenFilterFactory {
+ maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the [" + maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the ["
+ IndexSettings.MAX_NGRAM_DIFF_SETTING.getKey() + "] index level setting."); + IndexSettings.MAX_NGRAM_DIFF_SETTING.getKey() + "] index level setting.");
} else { } else {
deprecationLogger.deprecate("ngram_big_difference", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "ngram_big_difference",
"Deprecated big difference between max_gram and min_gram in NGram Tokenizer," "Deprecated big difference between max_gram and min_gram in NGram Tokenizer,"
+ "expected difference must be less than or equal to: [" + maxAllowedNgramDiff + "]"); + "expected difference must be less than or equal to: [" + maxAllowedNgramDiff + "]");
} }
@ -71,8 +72,8 @@ public class NGramTokenFilterFactory extends AbstractTokenFilterFactory {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
} }

View file

@ -22,6 +22,7 @@ package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.ngram.NGramTokenizer; import org.apache.lucene.analysis.ngram.NGramTokenizer;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.IndexSettings;
@ -118,7 +119,7 @@ public class NGramTokenizerFactory extends AbstractTokenizerFactory {
+ maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the [" + maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the ["
+ IndexSettings.MAX_NGRAM_DIFF_SETTING.getKey() + "] index level setting."); + IndexSettings.MAX_NGRAM_DIFF_SETTING.getKey() + "] index level setting.");
} else { } else {
deprecationLogger.deprecate("ngram_big_difference", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "ngram_big_difference",
"Deprecated big difference between max_gram and min_gram in NGram Tokenizer," "Deprecated big difference between max_gram and min_gram in NGram Tokenizer,"
+ "expected difference must be less than or equal to: [" + maxAllowedNgramDiff + "]"); + "expected difference must be less than or equal to: [" + maxAllowedNgramDiff + "]");
} }

View file

@ -21,6 +21,7 @@ package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.CharArraySet;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -49,7 +50,7 @@ public class StandardHtmlStripAnalyzerProvider extends AbstractIndexAnalyzerProv
throw new IllegalArgumentException("[standard_html_strip] analyzer is not supported for new indices, " + throw new IllegalArgumentException("[standard_html_strip] analyzer is not supported for new indices, " +
"use a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus [lowercase] filter"); "use a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus [lowercase] filter");
} else { } else {
DEPRECATION_LOGGER.deprecate("standard_html_strip_deprecation", DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "standard_html_strip_deprecation",
"Deprecated analyzer [standard_html_strip] used, " + "Deprecated analyzer [standard_html_strip] used, " +
"replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus [lowercase] filter"); "replace it with a custom analyzer using [standard] tokenizer and [html_strip] char_filter, plus [lowercase] filter");
} }

View file

@ -23,6 +23,7 @@ import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.synonym.SynonymFilter; import org.apache.lucene.analysis.synonym.SynonymFilter;
import org.apache.lucene.analysis.synonym.SynonymMap; import org.apache.lucene.analysis.synonym.SynonymMap;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -57,7 +58,7 @@ public class SynonymTokenFilterFactory extends AbstractTokenFilterFactory {
this.settings = settings; this.settings = settings;
if (settings.get("ignore_case") != null) { if (settings.get("ignore_case") != null) {
DEPRECATION_LOGGER.deprecate("synonym_ignore_case_option", DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_ignore_case_option",
"The ignore_case option on the synonym_graph filter is deprecated. " + "The ignore_case option on the synonym_graph filter is deprecated. " +
"Instead, insert a lowercase filter in the filter chain before the synonym_graph filter."); "Instead, insert a lowercase filter in the filter chain before the synonym_graph filter.");
} }

View file

@ -24,6 +24,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterGraphFilter; import org.apache.lucene.analysis.miscellaneous.WordDelimiterGraphFilter;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator; import org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -112,8 +113,8 @@ public class WordDelimiterGraphTokenFilterFactory extends AbstractTokenFilterFac
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
} }

View file

@ -24,6 +24,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter; import org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator; import org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -115,8 +116,8 @@ public class WordDelimiterTokenFilterFactory extends AbstractTokenFilterFactory
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
} }

View file

@ -21,6 +21,7 @@ package org.elasticsearch.ingest.common;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -55,7 +56,7 @@ public final class ScriptProcessor extends AbstractProcessor {
DeprecationLogger.getLogger(DynamicMap.class); DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.common.collect.Map.of( private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"_type", value -> { "_type", value -> {
deprecationLogger.deprecate("script_processor", deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "script_processor",
"[types removal] Looking up doc types [_type] in scripts is deprecated."); "[types removal] Looking up doc types [_type] in scripts is deprecated.");
return value; return value;
}); });

View file

@ -19,6 +19,7 @@
package org.elasticsearch.ingest.useragent; package org.elasticsearch.ingest.useragent;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.ingest.AbstractProcessor; import org.elasticsearch.ingest.AbstractProcessor;
import org.elasticsearch.ingest.IngestDocument; import org.elasticsearch.ingest.IngestDocument;
@ -314,7 +315,7 @@ public class UserAgentProcessor extends AbstractProcessor {
} }
if (useECS == false) { if (useECS == false) {
deprecationLogger.deprecate("ecs_false_non_common_schema", deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ecs_false_non_common_schema",
"setting [ecs] to false for non-common schema " + "setting [ecs] to false for non-common schema " +
"format is deprecated and will be removed in 8.0, set to true or remove to use the non-deprecated format"); "format is deprecated and will be removed in 8.0, set to true or remove to use the non-deprecated format");
} }
@ -357,7 +358,7 @@ public class UserAgentProcessor extends AbstractProcessor {
Property value = valueOf(propertyName.toUpperCase(Locale.ROOT)); Property value = valueOf(propertyName.toUpperCase(Locale.ROOT));
if (DEPRECATED_PROPERTIES.contains(value)) { if (DEPRECATED_PROPERTIES.contains(value)) {
final String key = "user_agent_processor_property_" + propertyName.replaceAll("[^\\w_]+", "_"); final String key = "user_agent_processor_property_" + propertyName.replaceAll("[^\\w_]+", "_");
deprecationLogger.deprecate(key, deprecationLogger.deprecate(DeprecationCategory.PARSING, key,
"the [{}] property is deprecated for the user-agent processor", propertyName); "the [{}] property is deprecated for the user-agent processor", propertyName);
} }
return value; return value;

View file

@ -20,6 +20,7 @@
package org.elasticsearch.script.mustache; package org.elasticsearch.script.mustache;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -84,7 +85,7 @@ public class RestMultiSearchTemplateAction extends BaseRestHandler {
// Emit a single deprecation message if any search template contains types. // Emit a single deprecation message if any search template contains types.
for (SearchTemplateRequest searchTemplateRequest : multiRequest.requests()) { for (SearchTemplateRequest searchTemplateRequest : multiRequest.requests()) {
if (searchTemplateRequest.getRequest().types().length > 0) { if (searchTemplateRequest.getRequest().types().length > 0) {
deprecationLogger.deprecate("msearch_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "msearch_with_types", TYPES_DEPRECATION_MESSAGE);
break; break;
} }
} }

View file

@ -32,6 +32,7 @@ import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -141,7 +142,7 @@ public class HasChildQueryBuilder extends AbstractQueryBuilder<HasChildQueryBuil
throw new IllegalArgumentException("[" + NAME + "] requires non-negative 'min_children' field"); throw new IllegalArgumentException("[" + NAME + "] requires non-negative 'min_children' field");
} }
if (minChildren == 0) { if (minChildren == 0) {
deprecationLogger.deprecate("min_children", MIN_CHILDREN_0_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.QUERIES, "min_children", MIN_CHILDREN_0_DEPRECATION_MESSAGE);
} }
if (maxChildren < 0) { if (maxChildren < 0) {
throw new IllegalArgumentException("[" + NAME + "] requires non-negative 'max_children' field"); throw new IllegalArgumentException("[" + NAME + "] requires non-negative 'max_children' field");

View file

@ -54,6 +54,7 @@ import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -468,7 +469,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
} }
GetRequest getRequest; GetRequest getRequest;
if (indexedDocumentType != null) { if (indexedDocumentType != null) {
deprecationLogger.deprecate("percolate_with_type", TYPE_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "percolate_with_type", TYPE_DEPRECATION_MESSAGE);
getRequest = new GetRequest(indexedDocumentIndex, indexedDocumentType, indexedDocumentId); getRequest = new GetRequest(indexedDocumentIndex, indexedDocumentType, indexedDocumentId);
} else { } else {
getRequest = new GetRequest(indexedDocumentIndex, indexedDocumentId); getRequest = new GetRequest(indexedDocumentIndex, indexedDocumentId);
@ -537,7 +538,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
final List<ParsedDocument> docs = new ArrayList<>(); final List<ParsedDocument> docs = new ArrayList<>();
String type = context.getType(); String type = context.getType();
if (documentType != null) { if (documentType != null) {
deprecationLogger.deprecate("percolate_with_document_type", DOCUMENT_TYPE_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "percolate_with_document_type", DOCUMENT_TYPE_DEPRECATION_MESSAGE);
if (documentType.equals(type) == false) { if (documentType.equals(type) == false) {
throw new IllegalArgumentException("specified document_type [" + documentType + throw new IllegalArgumentException("specified document_type [" + documentType +
"] is not equal to the actual type [" + type + "]"); "] is not equal to the actual type [" + type + "]");

View file

@ -33,6 +33,7 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -66,7 +67,7 @@ public class ReindexValidator {
state); state);
SearchSourceBuilder searchSource = request.getSearchRequest().source(); SearchSourceBuilder searchSource = request.getSearchRequest().source();
if (searchSource != null && searchSource.sorts() != null && searchSource.sorts().isEmpty() == false) { if (searchSource != null && searchSource.sorts() != null && searchSource.sorts().isEmpty() == false) {
deprecationLogger.deprecate("reindex_sort", SORT_DEPRECATED_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE);
} }
} }

View file

@ -27,6 +27,7 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.Request; import org.elasticsearch.client.Request;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -184,7 +185,7 @@ final class RemoteRequestBuilders {
private static String encodeIndex(String s) { private static String encodeIndex(String s) {
if (s.contains("%")) { // already encoded, pass-through to allow this in mixed version clusters if (s.contains("%")) { // already encoded, pass-through to allow this in mixed version clusters
checkIndexOrType("Index", s); checkIndexOrType("Index", s);
DEPRECATION_LOGGER.deprecate("reindex_url_encoded_index", DEPRECATED_URL_ENCODED_INDEX_WARNING); DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "reindex_url_encoded_index", DEPRECATED_URL_ENCODED_INDEX_WARNING);
return s; return s;
} }
try { try {

View file

@ -24,6 +24,7 @@ import com.ibm.icu.text.Normalizer2;
import com.ibm.icu.text.UnicodeSet; import com.ibm.icu.text.UnicodeSet;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -60,7 +61,7 @@ public class IcuNormalizerTokenFilterFactory extends AbstractTokenFilterFactory
String unicodeSetFilter = settings.get("unicodeSetFilter"); String unicodeSetFilter = settings.get("unicodeSetFilter");
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) {
if (unicodeSetFilter != null) { if (unicodeSetFilter != null) {
deprecationLogger.deprecate("icu_normalizer_unicode_set_filter", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "icu_normalizer_unicode_set_filter",
"[unicodeSetFilter] has been deprecated in favor of [unicode_set_filter]"); "[unicodeSetFilter] has been deprecated in favor of [unicode_set_filter]");
} else { } else {
unicodeSetFilter = settings.get("unicode_set_filter"); unicodeSetFilter = settings.get("unicode_set_filter");

View file

@ -36,6 +36,7 @@ import org.apache.lucene.analysis.phonetic.DaitchMokotoffSoundexFilter;
import org.apache.lucene.analysis.phonetic.DoubleMetaphoneFilter; import org.apache.lucene.analysis.phonetic.DoubleMetaphoneFilter;
import org.apache.lucene.analysis.phonetic.PhoneticFilter; import org.apache.lucene.analysis.phonetic.PhoneticFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -150,8 +151,8 @@ public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
+ "] will not be usable to parse synonyms after v7.0"); "Token filter [" + name() + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
} }

View file

@ -23,6 +23,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService; import org.elasticsearch.cloud.azure.classic.management.AzureComputeService;
import org.elasticsearch.cloud.azure.classic.management.AzureComputeServiceImpl; import org.elasticsearch.cloud.azure.classic.management.AzureComputeServiceImpl;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
@ -48,7 +49,7 @@ public class AzureDiscoveryPlugin extends Plugin implements DiscoveryPlugin {
public AzureDiscoveryPlugin(Settings settings) { public AzureDiscoveryPlugin(Settings settings) {
this.settings = settings; this.settings = settings;
deprecationLogger.deprecate("azure_discovery_plugin", "azure classic discovery plugin is deprecated."); deprecationLogger.deprecate(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated.");
logger.trace("starting azure classic discovery plugin..."); logger.trace("starting azure classic discovery plugin...");
} }

View file

@ -26,6 +26,7 @@ import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.BasicSessionCredentials; import com.amazonaws.auth.BasicSessionCredentials;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.SecureSetting;
import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.SecureString;
@ -135,12 +136,12 @@ final class Ec2ClientSettings {
return null; return null;
} else { } else {
if (key.length() == 0) { if (key.length() == 0) {
deprecationLogger.deprecate("ec2_invalid_settings", deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ec2_invalid_settings",
"Setting [{}] is set but [{}] is not, which will be unsupported in future", "Setting [{}] is set but [{}] is not, which will be unsupported in future",
SECRET_KEY_SETTING.getKey(), ACCESS_KEY_SETTING.getKey()); SECRET_KEY_SETTING.getKey(), ACCESS_KEY_SETTING.getKey());
} }
if (secret.length() == 0) { if (secret.length() == 0) {
deprecationLogger.deprecate("ec2_invalid_settings", deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ec2_invalid_settings",
"Setting [{}] is set but [{}] is not, which will be unsupported in future", "Setting [{}] is set but [{}] is not, which will be unsupported in future",
ACCESS_KEY_SETTING.getKey(), SECRET_KEY_SETTING.getKey()); ACCESS_KEY_SETTING.getKey(), SECRET_KEY_SETTING.getKey());
} }

View file

@ -31,6 +31,7 @@ import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.BlobPath;
import org.elasticsearch.common.blobstore.BlobStore; import org.elasticsearch.common.blobstore.BlobStore;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.SecureSetting;
import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.SecureString;
@ -257,7 +258,7 @@ class S3Repository extends MeteredBlobStoreRepository {
if (S3ClientSettings.checkDeprecatedCredentials(metadata.settings())) { if (S3ClientSettings.checkDeprecatedCredentials(metadata.settings())) {
// provided repository settings // provided repository settings
deprecationLogger.deprecate("s3_repository_secret_settings", deprecationLogger.deprecate(DeprecationCategory.SECURITY, "s3_repository_secret_settings",
"Using s3 access/secret key from repository settings. Instead " "Using s3 access/secret key from repository settings. Instead "
+ "store these in named clients and the elasticsearch keystore for secure settings."); + "store these in named clients and the elasticsearch keystore for secure settings.");
} }

View file

@ -128,7 +128,8 @@ public class EvilLoggerTests extends ESTestCase {
} }
for (int j = 0; j < iterations; j++) { for (int j = 0; j < iterations; j++) {
for (final Integer id : ids) { for (final Integer id : ids) {
deprecationLogger.deprecate(Integer.toString(id), "This is a maybe logged deprecation message" + id); deprecationLogger.deprecate(DeprecationCategory.OTHER, Integer.toString(id),
"This is a maybe logged deprecation message" + id);
} }
} }

View file

@ -83,7 +83,7 @@ public class JsonLoggerTests extends ESTestCase {
withThreadContext(threadContext -> { withThreadContext(threadContext -> {
threadContext.putHeader(Task.X_OPAQUE_ID, "someId"); threadContext.putHeader(Task.X_OPAQUE_ID, "someId");
final DeprecationLogger testLogger = DeprecationLogger.getLogger("test"); final DeprecationLogger testLogger = DeprecationLogger.getLogger("test");
testLogger.deprecate("someKey", "deprecated message1"); testLogger.deprecate(DeprecationCategory.OTHER, "someKey", "deprecated message1");
final Path path = PathUtils.get( final Path path = PathUtils.get(
System.getProperty("es.logs.base_path"), System.getProperty("es.logs.base_path"),
@ -116,10 +116,10 @@ public class JsonLoggerTests extends ESTestCase {
public void testDeprecatedMessageWithoutXOpaqueId() throws IOException { public void testDeprecatedMessageWithoutXOpaqueId() throws IOException {
final Logger testLogger = LogManager.getLogger("test"); final Logger testLogger = LogManager.getLogger("test");
testLogger.info(new DeprecatedMessage("key", "someId", "deprecated message1")); testLogger.info(new DeprecatedMessage(DeprecationCategory.OTHER, "key", "someId", "deprecated message1"));
testLogger.info(new DeprecatedMessage("key", "", "deprecated message2")); testLogger.info(new DeprecatedMessage(DeprecationCategory.OTHER, "key", "", "deprecated message2"));
// This message will be filtered out by the RateLimitingFilter because an empty ID is the same as a null one. // This message will be filtered out by the RateLimitingFilter because an empty ID is the same as a null one.
testLogger.info(new DeprecatedMessage("key", null, "deprecated message3")); testLogger.info(new DeprecatedMessage(DeprecationCategory.OTHER, "key", null, "deprecated message3"));
testLogger.info("deprecated message4"); testLogger.info("deprecated message4");
final Path path = PathUtils.get(System.getProperty("es.logs.base_path"), final Path path = PathUtils.get(System.getProperty("es.logs.base_path"),
@ -279,8 +279,8 @@ public class JsonLoggerTests extends ESTestCase {
// For the same key and X-Opaque-ID deprecation should be once // For the same key and X-Opaque-ID deprecation should be once
withThreadContext(threadContext -> { withThreadContext(threadContext -> {
threadContext.putHeader(Task.X_OPAQUE_ID, "ID1"); threadContext.putHeader(Task.X_OPAQUE_ID, "ID1");
deprecationLogger.deprecate("key", "message1"); deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.deprecate("key", "message2"); deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2");
assertWarnings("message1", "message2"); assertWarnings("message1", "message2");
final Path path = PathUtils.get(System.getProperty("es.logs.base_path"), final Path path = PathUtils.get(System.getProperty("es.logs.base_path"),
@ -307,8 +307,8 @@ public class JsonLoggerTests extends ESTestCase {
//continuing with message1-ID1 in logs already, adding a new deprecation log line with message2-ID2 //continuing with message1-ID1 in logs already, adding a new deprecation log line with message2-ID2
withThreadContext(threadContext -> { withThreadContext(threadContext -> {
threadContext.putHeader(Task.X_OPAQUE_ID, "ID2"); threadContext.putHeader(Task.X_OPAQUE_ID, "ID2");
deprecationLogger.deprecate("key", "message1"); deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.deprecate("key", "message2"); deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2");
assertWarnings("message1", "message2"); assertWarnings("message1", "message2");
final Path path = PathUtils.get( final Path path = PathUtils.get(

View file

@ -28,6 +28,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
@ -82,7 +83,7 @@ public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotin
} }
if (nodeDescriptions.length > 0) { if (nodeDescriptions.length > 0) {
deprecationLogger.deprecate("voting_config_exclusion", DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.API, "voting_config_exclusion", DEPRECATION_MESSAGE);
} }
this.nodeDescriptions = nodeDescriptions; this.nodeDescriptions = nodeDescriptions;
@ -104,7 +105,7 @@ public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotin
timeout = in.readTimeValue(); timeout = in.readTimeValue();
if (nodeDescriptions.length > 0) { if (nodeDescriptions.length > 0) {
deprecationLogger.deprecate("voting_config_exclusion", deprecationLogger.deprecate(DeprecationCategory.API, "voting_config_exclusion",
"nodeDescription is deprecated and will be removed, use nodeIds or nodeNames instead"); "nodeDescription is deprecated and will be removed, use nodeIds or nodeNames instead");
} }

View file

@ -27,6 +27,7 @@ import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.ToXContentObject;
@ -489,7 +490,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
if (!(entry.getValue() instanceof Map)) { if (!(entry.getValue() instanceof Map)) {
throw new IllegalArgumentException("malformed settings section"); throw new IllegalArgumentException("malformed settings section");
} }
DEPRECATION_LOGGER.deprecate("RestoreSnapshotRequest#settings", DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "RestoreSnapshotRequest#settings",
"specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version"); "specifying [settings] when restoring a snapshot has no effect and will not be supported in a future version");
} else if (name.equals("include_global_state")) { } else if (name.equals("include_global_state")) {
includeGlobalState = nodeBooleanValue(entry.getValue(), "include_global_state"); includeGlobalState = nodeBooleanValue(entry.getValue(), "include_global_state");

View file

@ -30,6 +30,7 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.indices.SystemIndices; import org.elasticsearch.indices.SystemIndices;
@ -111,7 +112,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
} }
} }
if (systemIndicesNames.isEmpty() == false) { if (systemIndicesNames.isEmpty() == false) {
deprecationLogger.deprecate("open_system_index_access", deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access",
"this request accesses system indices: {}, but in a future major version, direct access to system " + "this request accesses system indices: {}, but in a future major version, direct access to system " +
"indices will be prevented by default", systemIndicesNames); "indices will be prevented by default", systemIndicesNames);
} else { } else {
@ -124,7 +125,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
.filter(alias -> systemIndices.isSystemIndex(alias)) .filter(alias -> systemIndices.isSystemIndex(alias))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (systemAliases.isEmpty() == false) { if (systemAliases.isEmpty() == false) {
deprecationLogger.deprecate("open_system_alias_access", deprecationLogger.deprecate(DeprecationCategory.API, "open_system_alias_access",
"this request accesses aliases with names reserved for system indices: {}, but in a future major version, direct" + "this request accesses aliases with names reserved for system indices: {}, but in a future major version, direct" +
"access to system indices and their aliases will not be allowed", systemAliases); "access to system indices and their aliases will not be allowed", systemAliases);
} }

View file

@ -33,6 +33,7 @@ import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.DeprecationHandler; import org.elasticsearch.common.xcontent.DeprecationHandler;
@ -336,7 +337,7 @@ public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateR
if (name.equals("template")) { if (name.equals("template")) {
// This is needed to allow for bwc (beats, logstash) with pre-5.0 templates (#21009) // This is needed to allow for bwc (beats, logstash) with pre-5.0 templates (#21009)
if(entry.getValue() instanceof String) { if(entry.getValue() instanceof String) {
deprecationLogger.deprecate("put_index_template_field", deprecationLogger.deprecate(DeprecationCategory.API, "put_index_template_field",
"Deprecated field [template] used, replaced by [index_patterns]"); "Deprecated field [template] used, replaced by [index_patterns]");
patterns(Collections.singletonList((String) entry.getValue())); patterns(Collections.singletonList((String) entry.getValue()));
} }

View file

@ -27,6 +27,7 @@ import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -207,7 +208,8 @@ public final class BulkRequestParser {
index = stringDeduplicator.computeIfAbsent(parser.text(), Function.identity()); index = stringDeduplicator.computeIfAbsent(parser.text(), Function.identity());
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) { } else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
if (warnOnTypeUsage && typesDeprecationLogged == false) { if (warnOnTypeUsage && typesDeprecationLogged == false) {
deprecationLogger.deprecate("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "bulk_with_types",
RestBulkAction.TYPES_DEPRECATION_MESSAGE);
typesDeprecationLogged = true; typesDeprecationLogged = true;
} }
type = stringDeduplicator.computeIfAbsent(parser.text(), Function.identity()); type = stringDeduplicator.computeIfAbsent(parser.text(), Function.identity());

View file

@ -24,6 +24,7 @@ import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -183,7 +184,7 @@ public class SimulatePipelineRequest extends ActionRequest implements ToXContent
String index = ConfigurationUtils.readStringOrIntProperty(null, null, String index = ConfigurationUtils.readStringOrIntProperty(null, null,
dataMap, Metadata.INDEX.getFieldName(), "_index"); dataMap, Metadata.INDEX.getFieldName(), "_index");
if (dataMap.containsKey(Metadata.TYPE.getFieldName())) { if (dataMap.containsKey(Metadata.TYPE.getFieldName())) {
deprecationLogger.deprecate("simulate_pipeline_with_types", deprecationLogger.deprecate(DeprecationCategory.TYPES, "simulate_pipeline_with_types",
"[types removal] specifying _type in pipeline simulation requests is deprecated"); "[types removal] specifying _type in pipeline simulation requests is deprecated");
} }
String type = ConfigurationUtils.readStringOrIntProperty(null, null, String type = ConfigurationUtils.readStringOrIntProperty(null, null,

View file

@ -28,6 +28,7 @@ import org.elasticsearch.common.CheckedBiConsumer;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.NamedXContentRegistry;
@ -195,7 +196,7 @@ public class MultiSearchRequest extends ActionRequest implements CompositeIndice
// support first line with \n // support first line with \n
if (nextMarker == 0) { if (nextMarker == 0) {
from = nextMarker + 1; from = nextMarker + 1;
deprecationLogger.deprecate("multi_search_empty_first_line", deprecationLogger.deprecate(DeprecationCategory.API, "multi_search_empty_first_line",
"support for empty first line before any action metadata in msearch API is deprecated and " + "support for empty first line before any action metadata in msearch API is deprecated and " +
"will be removed in the next major version"); "will be removed in the next major version");
continue; continue;

View file

@ -32,6 +32,7 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
@ -613,7 +614,7 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
termVectorsRequest.index = parser.text(); termVectorsRequest.index = parser.text();
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) { } else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
termVectorsRequest.type = parser.text(); termVectorsRequest.type = parser.text();
deprecationLogger.deprecate("termvectors_with_types", deprecationLogger.deprecate(DeprecationCategory.TYPES, "termvectors_with_types",
RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
} else if (ID.match(currentFieldName, parser.getDeprecationHandler())) { } else if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
if (termVectorsRequest.doc != null) { if (termVectorsRequest.doc != null) {

View file

@ -35,6 +35,7 @@ import org.elasticsearch.cli.UserException;
import org.elasticsearch.common.PidFile; import org.elasticsearch.common.PidFile;
import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.inject.CreationException; import org.elasticsearch.common.inject.CreationException;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.LogConfigurator; import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
@ -366,7 +367,7 @@ final class Bootstrap {
+ "requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. " + "requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. "
+ "If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.", + "If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.",
System.getProperty("java.home")); System.getProperty("java.home"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("java_version_11_required", message); DeprecationLogger.getLogger(Bootstrap.class).deprecate(DeprecationCategory.OTHER, "java_version_11_required", message);
} }
if (BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection") != null) { if (BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection") != null) {
final String message = String.format( final String message = String.format(
@ -374,7 +375,8 @@ final class Bootstrap {
"The Java option es.xcontent.strict_duplicate_detection is set to [%s]; " + "The Java option es.xcontent.strict_duplicate_detection is set to [%s]; " +
"this option is deprecated and non-functional and should be removed from Java configuration.", "this option is deprecated and non-functional and should be removed from Java configuration.",
BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection")); BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("strict_duplicate_detection_setting_removed", message); DeprecationLogger.getLogger(Bootstrap.class).deprecate(DeprecationCategory.SETTINGS,
"strict_duplicate_detection_setting_removed", message);
} }
if (environment.pidFile() != null) { if (environment.pidFile() != null) {
try { try {

View file

@ -28,6 +28,7 @@ import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
@ -322,7 +323,7 @@ public class IndexNameExpressionResolver {
.sorted() // reliable order for testing .sorted() // reliable order for testing
.collect(Collectors.toList()); .collect(Collectors.toList());
if (resolvedSystemIndices.isEmpty() == false) { if (resolvedSystemIndices.isEmpty() == false) {
deprecationLogger.deprecate("open_system_index_access", deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access",
"this request accesses system indices: {}, but in a future major version, direct access to system " + "this request accesses system indices: {}, but in a future major version, direct access to system " +
"indices will be prevented by default", resolvedSystemIndices); "indices will be prevented by default", resolvedSystemIndices);
} }

View file

@ -31,6 +31,7 @@ import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
@ -102,7 +103,7 @@ public class IndexTemplateMetadata extends AbstractDiffable<IndexTemplateMetadat
this.settings = settings; this.settings = settings;
this.mappings = mappings; this.mappings = mappings;
if (this.mappings.size() > 1) { if (this.mappings.size() > 1) {
deprecationLogger.deprecate("index-templates", deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "index-templates",
"Index template {} contains multiple typed mappings; templates in 8x will only support a single mapping", "Index template {} contains multiple typed mappings; templates in 8x will only support a single mapping",
name); name);
} }

View file

@ -55,6 +55,7 @@ import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.ValidationException;
import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.IndexScopedSettings; import org.elasticsearch.common.settings.IndexScopedSettings;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
@ -214,7 +215,7 @@ public class MetadataCreateIndexService {
} else if (isHidden) { } else if (isHidden) {
logger.trace("index [{}] is a hidden index", index); logger.trace("index [{}] is a hidden index", index);
} else { } else {
DEPRECATION_LOGGER.deprecate("index_name_starts_with_dot", DEPRECATION_LOGGER.deprecate(DeprecationCategory.INDICES, "index_name_starts_with_dot",
"index name [{}] starts with a dot '.', in the next major version, index names " + "index name [{}] starts with a dot '.', in the next major version, index names " +
"starting with a dot are reserved for hidden indices and system indices", index); "starting with a dot are reserved for hidden indices and system indices", index);
} }
@ -362,7 +363,7 @@ public class MetadataCreateIndexService {
request.index(), isHiddenFromRequest); request.index(), isHiddenFromRequest);
if (v1Templates.size() > 1) { if (v1Templates.size() > 1) {
DEPRECATION_LOGGER.deprecate("index_template_multiple_match", DEPRECATION_LOGGER.deprecate(DeprecationCategory.TEMPLATES, "index_template_multiple_match",
"index [{}] matches multiple legacy templates [{}], composable templates will only match a single template", "index [{}] matches multiple legacy templates [{}], composable templates will only match a single template",
request.index(), v1Templates.stream().map(IndexTemplateMetadata::name).sorted().collect(Collectors.joining(", "))); request.index(), v1Templates.stream().map(IndexTemplateMetadata::name).sorted().collect(Collectors.joining(", ")));
} }
@ -763,7 +764,7 @@ public class MetadataCreateIndexService {
*/ */
shardLimitValidator.validateShardLimit(indexSettings, currentState); shardLimitValidator.validateShardLimit(indexSettings, currentState);
if (indexSettings.getAsBoolean(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) == false) { if (indexSettings.getAsBoolean(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) == false) {
DEPRECATION_LOGGER.deprecate("soft_deletes_disabled", DEPRECATION_LOGGER.deprecate(DeprecationCategory.SETTINGS, "soft_deletes_disabled",
"Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. " + "Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. " +
"Please do not specify value for setting [index.soft_deletes.enabled] of index [" + request.index() + "]."); "Please do not specify value for setting [index.soft_deletes.enabled] of index [" + request.index() + "].");
} }
@ -1231,7 +1232,8 @@ public class MetadataCreateIndexService {
if (IndexSettings.INDEX_SOFT_DELETES_SETTING.get(indexSettings) && if (IndexSettings.INDEX_SOFT_DELETES_SETTING.get(indexSettings) &&
(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(indexSettings) (IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(indexSettings)
|| IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(indexSettings))) { || IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(indexSettings))) {
DEPRECATION_LOGGER.deprecate("translog_retention", "Translog retention settings [index.translog.retention.age] " DEPRECATION_LOGGER.deprecate(DeprecationCategory.SETTINGS, "translog_retention",
"Translog retention settings [index.translog.retention.age] "
+ "and [index.translog.retention.size] are deprecated and effectively ignored. They will be removed in a future version."); + "and [index.translog.retention.size] are deprecated and effectively ignored. They will be removed in a future version.");
} }
} }

View file

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.allocation.decider.AwarenessAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.AwarenessAllocationDecider;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
@ -66,7 +67,7 @@ public class OperationRouting {
if (ignoreAwarenessAttr == false) { if (ignoreAwarenessAttr == false) {
awarenessAttributes = AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings); awarenessAttributes = AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings);
if (awarenessAttributes.isEmpty() == false) { if (awarenessAttributes.isEmpty() == false) {
deprecationLogger.deprecate("searches_not_routed_on_awareness_attributes", deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "searches_not_routed_on_awareness_attributes",
IGNORE_AWARENESS_ATTRIBUTES_DEPRECATION_MESSAGE); IGNORE_AWARENESS_ATTRIBUTES_DEPRECATION_MESSAGE);
} }
clusterSettings.addSettingsUpdateConsumer(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING, clusterSettings.addSettingsUpdateConsumer(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING,
@ -91,7 +92,7 @@ public class OperationRouting {
boolean ignoreAwarenessAttr = parseBoolean(System.getProperty(IGNORE_AWARENESS_ATTRIBUTES_PROPERTY), false); boolean ignoreAwarenessAttr = parseBoolean(System.getProperty(IGNORE_AWARENESS_ATTRIBUTES_PROPERTY), false);
if (ignoreAwarenessAttr == false) { if (ignoreAwarenessAttr == false) {
if (this.awarenessAttributes.isEmpty() && awarenessAttributes.isEmpty() == false) { if (this.awarenessAttributes.isEmpty() && awarenessAttributes.isEmpty() == false) {
deprecationLogger.deprecate("searches_not_routed_on_awareness_attributes", deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "searches_not_routed_on_awareness_attributes",
IGNORE_AWARENESS_ATTRIBUTES_DEPRECATION_MESSAGE); IGNORE_AWARENESS_ATTRIBUTES_DEPRECATION_MESSAGE);
} }
this.awarenessAttributes = awarenessAttributes; this.awarenessAttributes = awarenessAttributes;

View file

@ -41,6 +41,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -101,9 +102,13 @@ public class DiskThresholdMonitor {
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings); this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
this.client = client; this.client = client;
if (diskThresholdSettings.isAutoReleaseIndexEnabled() == false) { if (diskThresholdSettings.isAutoReleaseIndexEnabled() == false) {
deprecationLogger.deprecate(DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"), deprecationLogger.deprecate(
DeprecationCategory.SETTINGS,
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"),
"[{}] will be removed in version {}", "[{}] will be removed in version {}",
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY, Version.V_7_4_0.major + 1); DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY,
Version.V_7_4_0.major + 1
);
} }
} }
@ -312,9 +317,12 @@ public class DiskThresholdMonitor {
updateIndicesReadOnly(indicesToAutoRelease, listener, false); updateIndicesReadOnly(indicesToAutoRelease, listener, false);
} else { } else {
deprecationLogger.deprecate( deprecationLogger.deprecate(
DeprecationCategory.SETTINGS,
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"), DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"),
"[{}] will be removed in version {}", "[{}] will be removed in version {}",
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY, Version.V_7_4_0.major + 1); DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY,
Version.V_7_4_0.major + 1
);
logger.debug("[{}] disabled, not releasing read-only-allow-delete block on indices: [{}]", logger.debug("[{}] disabled, not releasing read-only-allow-delete block on indices: [{}]",
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY, indicesToAutoRelease); DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY, indicesToAutoRelease);
listener.onResponse(null); listener.onResponse(null);

View file

@ -21,6 +21,7 @@ package org.elasticsearch.common.geo;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import java.io.IOException; import java.io.IOException;
@ -55,7 +56,8 @@ public enum SpatialStrategy implements Writeable {
return strategy; return strategy;
} }
} }
logger.deprecate("geo_strategy", "Unrecognised strategy [" + strategyName + "], falling back to [recursive]"); logger.deprecate(DeprecationCategory.OTHER, "geo_strategy",
"Unrecognised strategy [" + strategyName + "], falling back to [recursive]");
return null; return null;
} }
} }

View file

@ -21,6 +21,7 @@ package org.elasticsearch.common.joda;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.time.FormatNames; import org.elasticsearch.common.time.FormatNames;
@ -75,7 +76,8 @@ public class Joda {
String msg = "Camel case format name {} is deprecated and will be removed in a future version. " + String msg = "Camel case format name {} is deprecated and will be removed in a future version. " +
"Use snake case name {} instead."; "Use snake case name {} instead.";
getDeprecationLogger() getDeprecationLogger()
.deprecate("camelCaseDateFormat", msg, formatName.getCamelCaseName(), formatName.getSnakeCaseName()); .deprecate(DeprecationCategory.PARSING,"camelCaseDateFormat", msg, formatName.getCamelCaseName(),
formatName.getSnakeCaseName());
} }
DateTimeFormatter formatter; DateTimeFormatter formatter;
@ -159,8 +161,8 @@ public class Joda {
formatter = ISODateTimeFormat.weekDateTimeNoMillis(); formatter = ISODateTimeFormat.weekDateTimeNoMillis();
} else if (FormatNames.WEEKYEAR.matches(input)) { } else if (FormatNames.WEEKYEAR.matches(input)) {
getDeprecationLogger() getDeprecationLogger()
.deprecate("week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " + .deprecate(DeprecationCategory.PARSING, "week_year_format_name",
"Use \"weekyear\" format instead"); "Format name \"week_year\" is deprecated and will be removed in a future version. Use \"weekyear\" format instead");
formatter = ISODateTimeFormat.weekyear(); formatter = ISODateTimeFormat.weekyear();
} else if (FormatNames.WEEK_YEAR.matches(input)) { } else if (FormatNames.WEEK_YEAR.matches(input)) {
formatter = ISODateTimeFormat.weekyear(); formatter = ISODateTimeFormat.weekyear();
@ -289,7 +291,7 @@ public class Joda {
private static void maybeLogJodaDeprecation(String format) { private static void maybeLogJodaDeprecation(String format) {
if (JodaDeprecationPatterns.isDeprecatedPattern(format)) { if (JodaDeprecationPatterns.isDeprecatedPattern(format)) {
String suggestion = JodaDeprecationPatterns.formatSuggestion(format); String suggestion = JodaDeprecationPatterns.formatSuggestion(format);
getDeprecationLogger().deprecate("joda-pattern-deprecation", getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "joda-pattern-deprecation",
suggestion + " " + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS); suggestion + " " + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS);
} }
} }
@ -399,12 +401,13 @@ public class Joda {
long millis = new BigDecimal(text).longValue() * factor; long millis = new BigDecimal(text).longValue() * factor;
// check for deprecations, but after it has parsed correctly so invalid values aren't counted as deprecated // check for deprecations, but after it has parsed correctly so invalid values aren't counted as deprecated
if (millis < 0) { if (millis < 0) {
getDeprecationLogger().deprecate("epoch-negative", "Use of negative values" + getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "epoch-negative", "Use of negative values" +
" in epoch time formats is deprecated and will not be supported in the next major version of Elasticsearch."); " in epoch time formats is deprecated and will not be supported in the next major version of Elasticsearch.");
} }
if (scientificNotation.matcher(text).find()) { if (scientificNotation.matcher(text).find()) {
getDeprecationLogger().deprecate("epoch-scientific-notation", "Use of scientific notation" + getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "epoch-scientific-notation",
" in epoch time formats is deprecated and will not be supported in the next major version of Elasticsearch."); "Use of scientific notation in epoch time formats is deprecated and will not be supported in the "
+ "next major version of Elasticsearch.");
} }
DateTime dt = new DateTime(millis, DateTimeZone.UTC); DateTime dt = new DateTime(millis, DateTimeZone.UTC);
bucket.saveField(DateTimeFieldType.year(), dt.getYear()); bucket.saveField(DateTimeFieldType.year(), dt.getYear());

View file

@ -22,7 +22,9 @@ package org.elasticsearch.common.logging;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.MapBuilder;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* A logger message used by {@link DeprecationLogger}. * A logger message used by {@link DeprecationLogger}.
@ -31,12 +33,18 @@ import java.util.Map;
public class DeprecatedMessage extends ESLogMessage { public class DeprecatedMessage extends ESLogMessage {
public static final String X_OPAQUE_ID_FIELD_NAME = "x-opaque-id"; public static final String X_OPAQUE_ID_FIELD_NAME = "x-opaque-id";
public DeprecatedMessage(String key, String xOpaqueId, String messagePattern, Object... args) { public DeprecatedMessage(DeprecationCategory category, String key, String xOpaqueId, String messagePattern, Object... args) {
super(fieldMap(key, xOpaqueId), messagePattern, args); super(fieldMap(category, key, xOpaqueId), messagePattern, args);
} }
private static Map<String, Object> fieldMap(String key, String xOpaqueId) { private static Map<String, Object> fieldMap(DeprecationCategory category, String key, String xOpaqueId) {
final MapBuilder<String, Object> builder = MapBuilder.newMapBuilder(); final MapBuilder<String, Object> builder = MapBuilder.newMapBuilder();
// The fields below are emitted using ECS keys in `EcsJsonLayout`
Objects.requireNonNull(category, "category cannot be null");
builder.put("category", category.name().toLowerCase(Locale.ROOT));
if (Strings.isNullOrEmpty(key) == false) { if (Strings.isNullOrEmpty(key) == false) {
builder.put("key", key); builder.put("key", key);
} }

View file

@ -0,0 +1,45 @@
/*
* 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.common.logging;
/**
* Deprecation log messages are categorised so that consumers of the logs can easily aggregate them.
* <p>
* When categorising a message, you should consider the impact of the work required to mitigate the
* deprecation. For example, a settings change would normally be categorised as {@link #SETTINGS},
* but if the setting in question was related to security configuration, it may be more appropriate
* to categorise the deprecation message as {@link #SECURITY}.
*/
public enum DeprecationCategory {
AGGREGATIONS,
ANALYSIS,
API,
INDICES,
MAPPINGS,
OTHER,
PARSING,
PLUGINS,
QUERIES,
SCRIPTING,
SECURITY,
SETTINGS,
TEMPLATES,
TYPES
}

View file

@ -86,14 +86,19 @@ public class DeprecationLogger {
* Logs a message at the {@link #DEPRECATION} level. The message is also sent to the header warning logger, * Logs a message at the {@link #DEPRECATION} level. The message is also sent to the header warning logger,
* so that it can be returned to the client. * so that it can be returned to the client.
*/ */
public DeprecationLoggerBuilder deprecate(final String key, final String msg, final Object... params) { public DeprecationLoggerBuilder deprecate(
return new DeprecationLoggerBuilder().withDeprecation(key, msg, params); final DeprecationCategory category,
final String key,
final String msg,
final Object... params
) {
return new DeprecationLoggerBuilder().withDeprecation(category, key, msg, params);
} }
public class DeprecationLoggerBuilder { public class DeprecationLoggerBuilder {
public DeprecationLoggerBuilder withDeprecation(String key, String msg, Object[] params) { public DeprecationLoggerBuilder withDeprecation(DeprecationCategory category, String key, String msg, Object[] params) {
ESLogMessage deprecationMessage = new DeprecatedMessage(key, HeaderWarning.getXOpaqueId(), msg, params); ESLogMessage deprecationMessage = new DeprecatedMessage(category, key, HeaderWarning.getXOpaqueId(), msg, params);
logger.log(DEPRECATION, deprecationMessage); logger.log(DEPRECATION, deprecationMessage);

View file

@ -27,6 +27,7 @@ import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.MemorySizeValue; import org.elasticsearch.common.unit.MemorySizeValue;
@ -313,6 +314,16 @@ public class Setting<T> implements ToXContentObject {
return properties.contains(Property.PrivateIndex); return properties.contains(Property.PrivateIndex);
} }
/**
* Checks whether this is a secure setting.
* @param settings used to check whether this setting is secure
* @return whether this is a secure setting.
*/
public final boolean isSecure(Settings settings) {
final SecureSettings secureSettings = settings.getSecureSettings();
return secureSettings != null && secureSettings.getSettingNames().contains(getKey());
}
/** /**
* Returns the setting properties * Returns the setting properties
* @see Property * @see Property
@ -515,8 +526,7 @@ public class Setting<T> implements ToXContentObject {
* @return the raw string representation of the setting value * @return the raw string representation of the setting value
*/ */
String innerGetRaw(final Settings settings) { String innerGetRaw(final Settings settings) {
SecureSettings secureSettings = settings.getSecureSettings(); if (this.isSecure(settings)) {
if (secureSettings != null && secureSettings.getSettingNames().contains(getKey())) {
throw new IllegalArgumentException("Setting [" + getKey() + "] is a non-secure setting" + throw new IllegalArgumentException("Setting [" + getKey() + "] is a non-secure setting" +
" and must be stored inside elasticsearch.yml, but was found inside the Elasticsearch keystore"); " and must be stored inside elasticsearch.yml, but was found inside the Elasticsearch keystore");
} }
@ -529,8 +539,11 @@ public class Setting<T> implements ToXContentObject {
if (this.isDeprecated() && this.exists(settings)) { if (this.isDeprecated() && this.exists(settings)) {
// It would be convenient to show its replacement key, but replacement is often not so simple // It would be convenient to show its replacement key, but replacement is often not so simple
final String key = getKey(); final String key = getKey();
DeprecationCategory category = this.isSecure(settings) ? DeprecationCategory.SECURITY : DeprecationCategory.SETTINGS;
Settings.DeprecationLoggerHolder.deprecationLogger Settings.DeprecationLoggerHolder.deprecationLogger
.deprecate(key, "[{}] setting was deprecated in Elasticsearch and will be removed in a future release! " .deprecate(category, key, "[{}] setting was deprecated in Elasticsearch and will be removed in a future release! "
+ "See the breaking changes documentation for the next major version.", key); + "See the breaking changes documentation for the next major version.", key);
} }
} }

View file

@ -21,6 +21,7 @@ package org.elasticsearch.common.time;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.util.LazyInitializable; import org.elasticsearch.common.util.LazyInitializable;
@ -1662,7 +1663,8 @@ public class DateFormatters {
String msg = "Camel case format name {} is deprecated and will be removed in a future version. " + String msg = "Camel case format name {} is deprecated and will be removed in a future version. " +
"Use snake case name {} instead."; "Use snake case name {} instead.";
deprecationLogger.getOrCompute() deprecationLogger.getOrCompute()
.deprecate("camelCaseDateFormat", msg, formatName.getCamelCaseName(), formatName.getSnakeCaseName()); .deprecate(DeprecationCategory.PARSING, "camelCaseDateFormat", msg, formatName.getCamelCaseName(),
formatName.getSnakeCaseName());
} }
if (FormatNames.ISO8601.matches(input)) { if (FormatNames.ISO8601.matches(input)) {
@ -1743,7 +1745,8 @@ public class DateFormatters {
return WEEK_DATE_TIME_NO_MILLIS; return WEEK_DATE_TIME_NO_MILLIS;
} else if (FormatNames.WEEK_YEAR.matches(input)) { } else if (FormatNames.WEEK_YEAR.matches(input)) {
deprecationLogger.getOrCompute() deprecationLogger.getOrCompute()
.deprecate("week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " + .deprecate(DeprecationCategory.PARSING,
"week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " +
"Use \"weekyear\" format instead"); "Use \"weekyear\" format instead");
return WEEK_YEAR; return WEEK_YEAR;
} else if (FormatNames.WEEKYEAR.matches(input)) { } else if (FormatNames.WEEKYEAR.matches(input)) {

View file

@ -19,6 +19,7 @@
package org.elasticsearch.common.time; package org.elasticsearch.common.time;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
@ -200,7 +201,7 @@ public class DateUtils {
public static ZoneId of(String zoneId) { public static ZoneId of(String zoneId) {
String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId); String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId);
if (deprecatedId != null) { if (deprecatedId != null) {
deprecationLogger.deprecate("timezone", deprecationLogger.deprecate(DeprecationCategory.PARSING, "timezone",
"Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead"); "Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead");
return ZoneId.of(deprecatedId); return ZoneId.of(deprecatedId);
} }

View file

@ -25,6 +25,7 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.LogConfigurator; import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.ToXContentFragment;
@ -269,7 +270,7 @@ public class ByteSizeValue implements Writeable, Comparable<ByteSizeValue>, ToXC
try { try {
final double doubleValue = Double.parseDouble(s); final double doubleValue = Double.parseDouble(s);
DeprecationLoggerHolder.deprecationLogger DeprecationLoggerHolder.deprecationLogger
.deprecate("fractional_byte_values", .deprecate(DeprecationCategory.PARSING, "fractional_byte_values",
"Fractional bytes values are deprecated. Use non-fractional bytes values instead: [{}] found for setting [{}]", "Fractional bytes values are deprecated. Use non-fractional bytes values instead: [{}] found for setting [{}]",
initialInput, settingName); initialInput, settingName);
return new ByteSizeValue((long) (doubleValue * unit.toBytes(1))); return new ByteSizeValue((long) (doubleValue * unit.toBytes(1)));

View file

@ -21,6 +21,7 @@ package org.elasticsearch.common.util.concurrent;
import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Setting.Property;
@ -75,6 +76,7 @@ public class EsExecutors {
final int availableProcessors = Runtime.getRuntime().availableProcessors(); final int availableProcessors = Runtime.getRuntime().availableProcessors();
if (value > availableProcessors) { if (value > availableProcessors) {
deprecationLogger.deprecate( deprecationLogger.deprecate(
DeprecationCategory.SETTINGS,
"processors", "processors",
"setting [{}] to value [{}] which is more than available processors [{}] is deprecated", "setting [{}] to value [{}] which is more than available processors [{}] is deprecated",
name, name,

View file

@ -20,6 +20,7 @@
package org.elasticsearch.common.xcontent; package org.elasticsearch.common.xcontent;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -52,21 +53,21 @@ public class LoggingDeprecationHandler implements DeprecationHandler {
@Override @Override
public void usedDeprecatedName(String parserName, Supplier<XContentLocation> location, String usedName, String modernName) { public void usedDeprecatedName(String parserName, Supplier<XContentLocation> location, String usedName, String modernName) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.deprecate("deprecated_field", deprecationLogger.deprecate(DeprecationCategory.API, "deprecated_field",
"{}Deprecated field [{}] used, expected [{}] instead", prefix, usedName, modernName); "{}Deprecated field [{}] used, expected [{}] instead", prefix, usedName, modernName);
} }
@Override @Override
public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName, String replacedWith) { public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName, String replacedWith) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.deprecate("deprecated_field", deprecationLogger.deprecate(DeprecationCategory.API, "deprecated_field",
"{}Deprecated field [{}] used, replaced by [{}]", prefix, usedName, replacedWith); "{}Deprecated field [{}] used, replaced by [{}]", prefix, usedName, replacedWith);
} }
@Override @Override
public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName) { public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.deprecate("deprecated_field", deprecationLogger.deprecate(DeprecationCategory.API, "deprecated_field",
"{}Deprecated field [{}] used, this field is unused and will be removed entirely", prefix, usedName); "{}Deprecated field [{}] used, this field is unused and will be removed entirely", prefix, usedName);
} }
} }

View file

@ -21,6 +21,7 @@ package org.elasticsearch.http;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.BoundTransportAddress;
@ -73,6 +74,7 @@ public class HttpInfo implements ReportingService.Info {
String hostString = publishAddress.address().getHostString(); String hostString = publishAddress.address().getHostString();
if (CNAME_IN_PUBLISH_HOST) { if (CNAME_IN_PUBLISH_HOST) {
deprecationLogger.deprecate( deprecationLogger.deprecate(
DeprecationCategory.SETTINGS,
"cname_in_publish_address", "cname_in_publish_address",
"es.http.cname_in_publish_address system property is deprecated and no longer affects http.publish_address " + "es.http.cname_in_publish_address system property is deprecated and no longer affects http.publish_address " +
"formatting. Remove this property to get rid of this deprecation warning." "formatting. Remove this property to get rid of this deprecation warning."

View file

@ -22,6 +22,7 @@ package org.elasticsearch.index.analysis;
import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.indices.analysis.PreBuiltCacheFactory; import org.elasticsearch.indices.analysis.PreBuiltCacheFactory;
import org.elasticsearch.indices.analysis.PreBuiltCacheFactory.CachingStrategy; import org.elasticsearch.indices.analysis.PreBuiltCacheFactory.CachingStrategy;
@ -130,7 +131,7 @@ public final class PreConfiguredTokenFilter extends PreConfiguredAnalysisCompone
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate(name(), "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, name(), "Token filter [" + name()
+ "] will not be usable to parse synonyms after v7.0"); + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }
@ -157,7 +158,7 @@ public final class PreConfiguredTokenFilter extends PreConfiguredAnalysisCompone
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms"); throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate(name(), "Token filter [" + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, name(), "Token filter [" + name()
+ "] will not be usable to parse synonyms after v7.0"); + "] will not be usable to parse synonyms after v7.0");
return this; return this;
} }

View file

@ -23,6 +23,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute; import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute;
import org.apache.lucene.analysis.shingle.ShingleFilter; import org.apache.lucene.analysis.shingle.ShingleFilter;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -49,7 +50,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
+ " must be less than or equal to: [" + maxAllowedShingleDiff + "] but was [" + shingleDiff + "]. This limit" + " must be less than or equal to: [" + maxAllowedShingleDiff + "] but was [" + shingleDiff + "]. This limit"
+ " can be set by changing the [" + IndexSettings.MAX_SHINGLE_DIFF_SETTING.getKey() + "] index level setting."); + " can be set by changing the [" + IndexSettings.MAX_SHINGLE_DIFF_SETTING.getKey() + "] index level setting.");
} else { } else {
deprecationLogger.deprecate("excessive_shingle_diff", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "excessive_shingle_diff",
"Deprecated big difference between maxShingleSize and minShingleSize" + "Deprecated big difference between maxShingleSize and minShingleSize" +
" in Shingle TokenFilter, expected difference must be less than or equal to: [" + maxAllowedShingleDiff + "]"); " in Shingle TokenFilter, expected difference must be less than or equal to: [" + maxAllowedShingleDiff + "]");
} }
@ -75,7 +76,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
"] cannot be used to parse synonyms"); "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate("synonym_tokenfilters", "Token filter " + name() DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter " + name()
+ "] will not be usable to parse synonym after v7.0"); + "] will not be usable to parse synonym after v7.0");
} }
return this; return this;

View file

@ -31,6 +31,7 @@ import org.apache.lucene.search.suggest.document.RegexCompletionQuery;
import org.apache.lucene.search.suggest.document.SuggestField; import org.apache.lucene.search.suggest.document.SuggestField;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
@ -194,7 +195,7 @@ public class CompletionFieldMapper extends FieldMapper {
private void checkCompletionContextsLimit() { private void checkCompletionContextsLimit() {
if (this.contexts.getValue() != null && this.contexts.getValue().size() > COMPLETION_CONTEXTS_LIMIT) { if (this.contexts.getValue() != null && this.contexts.getValue().size() > COMPLETION_CONTEXTS_LIMIT) {
deprecationLogger.deprecate("excessive_completion_contexts", deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "excessive_completion_contexts",
"You have defined more than [" + COMPLETION_CONTEXTS_LIMIT + "] completion contexts" + "You have defined more than [" + COMPLETION_CONTEXTS_LIMIT + "] completion contexts" +
" in the mapping for field [" + name() + "]. " + " in the mapping for field [" + name() + "]. " +
"The maximum allowed number of completion contexts in a mapping will be limited to " + "The maximum allowed number of completion contexts in a mapping will be limited to " +

View file

@ -33,6 +33,7 @@ import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.geo.ShapeRelation; import org.elasticsearch.common.geo.ShapeRelation;
import org.elasticsearch.common.joda.Joda; import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.BytesRefs; import org.elasticsearch.common.lucene.BytesRefs;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
@ -277,8 +278,9 @@ public final class DateFieldMapper extends FieldMapper {
try { try {
return fieldType.parse(nullValue.getValue()); return fieldType.parse(nullValue.getValue());
} catch (Exception e) { } catch (Exception e) {
DEPRECATION_LOGGER.deprecate("date_mapper_null_field", "Error parsing [" + nullValue.getValue() DEPRECATION_LOGGER.deprecate(DeprecationCategory.MAPPINGS, "date_mapper_null_field",
+ "] as date in [null_value] on field [" + name() + "]); [null_value] will be ignored"); "Error parsing [" + nullValue.getValue() + "] as date in [null_value] on field [" + name() + "]);"
+ " [null_value] will be ignored");
return null; return null;
} }
} }

View file

@ -20,6 +20,7 @@
package org.elasticsearch.index.mapper; package org.elasticsearch.index.mapper;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.ToXContentObject;
@ -216,7 +217,7 @@ public class DynamicTemplate implements ToXContentObject {
if (indexVersionCreated.onOrAfter(Version.V_6_0_0_alpha1)) { if (indexVersionCreated.onOrAfter(Version.V_6_0_0_alpha1)) {
throw e; throw e;
} else { } else {
deprecationLogger.deprecate("invalid_mapping_type", deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "invalid_mapping_type",
"match_mapping_type [" + matchMappingType + "] is invalid and will be ignored: " "match_mapping_type [" + matchMappingType + "] is invalid and will be ignored: "
+ e.getMessage()); + e.getMessage());
// this template is on an unknown type so it will never match anything // this template is on an unknown type so it will never match anything

View file

@ -23,6 +23,7 @@ import org.apache.lucene.document.Field;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit; import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.TriFunction; import org.elasticsearch.common.TriFunction;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Setting.Property;
@ -969,14 +970,15 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
} }
Parameter<?> parameter = deprecatedParamsMap.get(propName); Parameter<?> parameter = deprecatedParamsMap.get(propName);
if (parameter != null) { if (parameter != null) {
deprecationLogger.deprecate(propName, "Parameter [{}] on mapper [{}] is deprecated, use [{}]", deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] on mapper [{}] is deprecated, use [{}]",
propName, name, parameter.name); propName, name, parameter.name);
} else { } else {
parameter = paramsMap.get(propName); parameter = paramsMap.get(propName);
} }
if (parameter == null) { if (parameter == null) {
if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) { if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) {
deprecationLogger.deprecate(propName, deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] has no effect on type [{}] and will be removed in future", propName, type); "Parameter [{}] has no effect on type [{}] and will be removed in future", propName, type);
iterator.remove(); iterator.remove();
continue; continue;
@ -984,7 +986,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
if (parserContext.isFromDynamicTemplate()) { if (parserContext.isFromDynamicTemplate()) {
// The parameter is unknown, but this mapping is from a dynamic template. // The parameter is unknown, but this mapping is from a dynamic template.
// Until 7.x it was possible to use unknown parameters there, so for bwc we need to ignore it // Until 7.x it was possible to use unknown parameters there, so for bwc we need to ignore it
deprecationLogger.deprecate(propName, deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, propName,
"Parameter [{}] is used in a dynamic template mapping and has no effect on type [{}]. " "Parameter [{}] is used in a dynamic template mapping and has no effect on type [{}]. "
+ "Usage will result in an error in future major versions and should be removed.", + "Usage will result in an error in future major versions and should be removed.",
propName, propName,
@ -999,12 +1001,13 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
} }
if (Objects.equals("boost", propName)) { if (Objects.equals("boost", propName)) {
deprecationLogger.deprecate( deprecationLogger.deprecate(
DeprecationCategory.MAPPINGS,
"boost", "boost",
"Parameter [boost] on field [{}] is deprecated and will be removed in 8.0", "Parameter [boost] on field [{}] is deprecated and will be removed in 8.0",
name); name);
} }
if (parameter.deprecated) { if (parameter.deprecated) {
deprecationLogger.deprecate(propName, deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] is deprecated and will be removed in a future version", "Parameter [{}] is deprecated and will be removed in a future version",
propName); propName);
} }

View file

@ -26,6 +26,7 @@ import org.apache.lucene.index.IndexableField;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit; import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.index.query.SearchExecutionContext; import org.elasticsearch.index.query.SearchExecutionContext;
@ -98,7 +99,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
@Override @Override
public FieldNamesFieldMapper build() { public FieldNamesFieldMapper build() {
if (enabled.getValue().explicit()) { if (enabled.getValue().explicit()) {
deprecationLogger.deprecate("field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE);
} }
FieldNamesFieldType fieldNamesFieldType = new FieldNamesFieldType(enabled.getValue().value()); FieldNamesFieldType fieldNamesFieldType = new FieldNamesFieldType(enabled.getValue().value());
return new FieldNamesFieldMapper(enabled.getValue(), indexVersionCreated, fieldNamesFieldType); return new FieldNamesFieldMapper(enabled.getValue(), indexVersionCreated, fieldNamesFieldType);
@ -143,7 +144,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
if (isEnabled() == false) { if (isEnabled() == false) {
throw new IllegalStateException("Cannot run [exists] queries if the [_field_names] field is disabled"); throw new IllegalStateException("Cannot run [exists] queries if the [_field_names] field is disabled");
} }
deprecationLogger.deprecate("terms_query_on_field_names", deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "terms_query_on_field_names",
"terms query on the _field_names field is deprecated and will be removed, use exists query instead"); "terms query on the _field_names field is deprecated and will be removed, use exists query instead");
return super.termQuery(value, context); return super.termQuery(value, context);
} }

View file

@ -28,6 +28,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.SortField; import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermInSetQuery; import org.apache.lucene.search.TermInSetQuery;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.BigArrays;
@ -164,7 +165,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
IndexFieldDataCache cache, IndexFieldDataCache cache,
CircuitBreakerService breakerService CircuitBreakerService breakerService
) { ) {
deprecationLogger.deprecate("id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE);
final IndexFieldData<?> fieldData = fieldDataBuilder.build(cache, breakerService); final IndexFieldData<?> fieldData = fieldDataBuilder.build(cache, breakerService);
return new IndexFieldData<LeafFieldData>() { return new IndexFieldData<LeafFieldData>() {
@Override @Override

View file

@ -30,6 +30,7 @@ import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.fielddata.IndexFieldData;
@ -98,7 +99,7 @@ public class IpFieldMapper extends FieldMapper {
try { try {
return InetAddresses.forString(nullValueAsString); return InetAddresses.forString(nullValueAsString);
} catch (Exception e) { } catch (Exception e) {
DEPRECATION_LOGGER.deprecate("ip_mapper_null_field", "Error parsing [" + nullValue.getValue() DEPRECATION_LOGGER.deprecate(DeprecationCategory.MAPPINGS, "ip_mapper_null_field", "Error parsing [" + nullValue.getValue()
+ "] as IP in [null_value] on field [" + name() + "]); [null_value] will be ignored"); + "] as IP in [null_value] on field [" + name() + "]); [null_value] will be ignored");
return null; return null;
} }

View file

@ -29,6 +29,7 @@ import org.elasticsearch.cluster.metadata.MappingMetadata;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Setting.Property;
@ -458,7 +459,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException(DEFAULT_MAPPING_ERROR_MESSAGE); throw new IllegalArgumentException(DEFAULT_MAPPING_ERROR_MESSAGE);
} else if (reason == MergeReason.MAPPING_UPDATE) { // only log in case of explicit mapping updates } else if (reason == MergeReason.MAPPING_UPDATE) { // only log in case of explicit mapping updates
deprecationLogger.deprecate("default_mapping_not_allowed", DEFAULT_MAPPING_ERROR_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "default_mapping_not_allowed", DEFAULT_MAPPING_ERROR_MESSAGE);
} }
assert defaultMapper.type().equals(DEFAULT_MAPPING); assert defaultMapper.type().equals(DEFAULT_MAPPING);
results.put(DEFAULT_MAPPING, defaultMapper); results.put(DEFAULT_MAPPING, defaultMapper);

View file

@ -27,6 +27,7 @@ import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit; import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.collect.CopyOnWriteHashMap; import org.elasticsearch.common.collect.CopyOnWriteHashMap;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -254,7 +255,7 @@ public class ObjectMapper extends Mapper implements Cloneable {
} }
return true; return true;
} else if (fieldName.equals("include_in_all")) { } else if (fieldName.equals("include_in_all")) {
deprecationLogger.deprecate("include_in_all", deprecationLogger.deprecate(DeprecationCategory.API, "include_in_all",
"[include_in_all] is deprecated, the _all field have been removed in this version"); "[include_in_all] is deprecated, the _all field have been removed in this version");
return true; return true;
} }

View file

@ -23,6 +23,7 @@ import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit; import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
@ -445,7 +446,7 @@ public class RootObjectMapper extends ObjectMapper {
} else { } else {
deprecationMessage = message; deprecationMessage = message;
} }
DEPRECATION_LOGGER.deprecate("invalid_dynamic_template", deprecationMessage); DEPRECATION_LOGGER.deprecate(DeprecationCategory.TEMPLATES, "invalid_dynamic_template", deprecationMessage);
} }
} }

View file

@ -26,6 +26,7 @@ import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.geo.ShapeRelation; import org.elasticsearch.common.geo.ShapeRelation;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.time.DateMathParser; import org.elasticsearch.common.time.DateMathParser;
@ -48,7 +49,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
"in queries and aggregations is deprecated, prefer to use a field instead."; "in queries and aggregations is deprecated, prefer to use a field instead.";
public static void emitTypesDeprecationWarning() { public static void emitTypesDeprecationWarning() {
deprecationLogger.deprecate("query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
public static final String NAME = "_type"; public static final String NAME = "_type";

View file

@ -21,6 +21,7 @@ package org.elasticsearch.index.mapper;
import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData; import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData;
@ -65,13 +66,13 @@ public final class TypeFieldType extends ConstantFieldType {
@Override @Override
public Query existsQuery(SearchExecutionContext context) { public Query existsQuery(SearchExecutionContext context) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
return new MatchAllDocsQuery(); return new MatchAllDocsQuery();
} }
@Override @Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) { public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.KEYWORD); return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.KEYWORD);
} }
@ -82,7 +83,7 @@ public final class TypeFieldType extends ConstantFieldType {
@Override @Override
protected boolean matches(String pattern, boolean caseInsensitive, SearchExecutionContext context) { protected boolean matches(String pattern, boolean caseInsensitive, SearchExecutionContext context) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
if (caseInsensitive) { if (caseInsensitive) {
return pattern.equalsIgnoreCase(type); return pattern.equalsIgnoreCase(type);
} }

View file

@ -19,6 +19,7 @@
package org.elasticsearch.index.mapper; package org.elasticsearch.index.mapper;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.index.similarity.SimilarityProvider; import org.elasticsearch.index.similarity.SimilarityProvider;
@ -98,7 +99,8 @@ public class TypeParsers {
Mapper.TypeParser.ParserContext parserContext, String propName, Object propNode) { Mapper.TypeParser.ParserContext parserContext, String propName, Object propNode) {
if (propName.equals("fields")) { if (propName.equals("fields")) {
if (parserContext.isWithinMultiField()) { if (parserContext.isWithinMultiField()) {
deprecationLogger.deprecate("multifield_within_multifield", "At least one multi-field, [" + name + "], was " + deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "multifield_within_multifield",
"At least one multi-field, [" + name + "], was " +
"encountered that itself contains a multi-field. Defining multi-fields within a multi-field is deprecated and will " + "encountered that itself contains a multi-field. Defining multi-fields within a multi-field is deprecated and will " +
"no longer be supported in 8.0. To resolve the issue, all instances of [fields] that occur within a [fields] block " + "no longer be supported in 8.0. To resolve the issue, all instances of [fields] that occur within a [fields] block " +
"should be removed from the mappings, either by flattening the chained [fields] blocks into a single level, or " + "should be removed from the mappings, either by flattening the chained [fields] blocks into a single level, or " +

View file

@ -30,6 +30,7 @@ import org.elasticsearch.common.geo.builders.ShapeBuilder;
import org.elasticsearch.common.geo.parsers.ShapeParser; import org.elasticsearch.common.geo.parsers.ShapeParser;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
@ -253,7 +254,7 @@ public class GeoShapeQueryBuilder extends AbstractGeometryQueryBuilder<GeoShapeQ
GeoShapeQueryBuilder builder; GeoShapeQueryBuilder builder;
if (pgsqp.type != null) { if (pgsqp.type != null) {
deprecationLogger.deprecate("geo_share_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "geo_share_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
if (pgsqp.shape != null) { if (pgsqp.shape != null) {

View file

@ -27,6 +27,7 @@ import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -151,7 +152,7 @@ public class IdsQueryBuilder extends AbstractQueryBuilder<IdsQueryBuilder> {
try { try {
IdsQueryBuilder builder = PARSER.apply(parser, null); IdsQueryBuilder builder = PARSER.apply(parser, null);
if (builder.types().length > 0) { if (builder.types().length > 0) {
deprecationLogger.deprecate("ids_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "ids_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
return builder; return builder;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View file

@ -41,6 +41,7 @@ import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.search.MoreLikeThisQuery; import org.elasticsearch.common.lucene.search.MoreLikeThisQuery;
import org.elasticsearch.common.lucene.search.XMoreLikeThis; import org.elasticsearch.common.lucene.search.XMoreLikeThis;
@ -967,7 +968,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
} }
if (moreLikeThisQueryBuilder.isTypeless() == false) { if (moreLikeThisQueryBuilder.isTypeless() == false) {
deprecationLogger.deprecate("more_like_this_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.API, "more_like_this_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
return moreLikeThisQueryBuilder; return moreLikeThisQueryBuilder;
} }

View file

@ -35,6 +35,7 @@ import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.TriFunction; import org.elasticsearch.common.TriFunction;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
@ -389,7 +390,7 @@ public class SearchExecutionContext extends QueryRewriteContext {
*/ */
public MappedFieldType buildAnonymousFieldType(String type) { public MappedFieldType buildAnonymousFieldType(String type) {
if (type.equals("string")) { if (type.equals("string")) {
deprecationLogger.deprecate("unmapped_type_string", deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "unmapped_type_string",
"[unmapped_type:string] should be replaced with [unmapped_type:keyword]"); "[unmapped_type:string] should be replaced with [unmapped_type:keyword]");
type = "keyword"; type = "keyword";
} }

View file

@ -27,6 +27,7 @@ import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -128,7 +129,7 @@ public class TypeQueryBuilder extends AbstractQueryBuilder<TypeQueryBuilder> {
@Override @Override
protected Query doToQuery(SearchExecutionContext context) throws IOException { protected Query doToQuery(SearchExecutionContext context) throws IOException {
deprecationLogger.deprecate("type_query", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "type_query", TYPES_DEPRECATION_MESSAGE);
if (context.getType().equals(type)) { if (context.getType().equals(type)) {
return Queries.newNonNestedFilter(context.indexVersionCreated()); return Queries.newNonNestedFilter(context.indexVersionCreated());
} else { } else {

View file

@ -22,6 +22,7 @@ import org.elasticsearch.Version;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.search.function.RandomScoreFunction; import org.elasticsearch.common.lucene.search.function.RandomScoreFunction;
import org.elasticsearch.common.lucene.search.function.ScoreFunction; import org.elasticsearch.common.lucene.search.function.ScoreFunction;
@ -162,7 +163,7 @@ public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder<RandomScore
} else { } else {
String fieldName; String fieldName;
if (field == null) { if (field == null) {
deprecationLogger.deprecate("seed_requires_field", deprecationLogger.deprecate(DeprecationCategory.QUERIES, "seed_requires_field",
"As of version 7.0 Elasticsearch will require that a [field] parameter is provided when a [seed] is set"); "As of version 7.0 Elasticsearch will require that a [field] parameter is provided when a [seed] is set");
fieldName = IdFieldMapper.NAME; fieldName = IdFieldMapper.NAME;
} else { } else {

View file

@ -28,6 +28,7 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
@ -373,7 +374,7 @@ public class ReindexRequest extends AbstractBulkIndexByScrollRequest<ReindexRequ
} }
String[] types = extractStringArray(source, "type"); String[] types = extractStringArray(source, "type");
if (types != null) { if (types != null) {
deprecationLogger.deprecate("reindex_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "reindex_with_types", TYPES_DEPRECATION_MESSAGE);
request.getSearchRequest().types(types); request.getSearchRequest().types(types);
} }
request.setRemoteInfo(buildRemoteInfo(source)); request.setRemoteInfo(buildRemoteInfo(source));
@ -389,7 +390,7 @@ public class ReindexRequest extends AbstractBulkIndexByScrollRequest<ReindexRequ
ObjectParser<IndexRequest, Void> destParser = new ObjectParser<>("dest"); ObjectParser<IndexRequest, Void> destParser = new ObjectParser<>("dest");
destParser.declareString(IndexRequest::index, new ParseField("index")); destParser.declareString(IndexRequest::index, new ParseField("index"));
destParser.declareString((request, type) -> { destParser.declareString((request, type) -> {
deprecationLogger.deprecate("reindex_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "reindex_with_types", TYPES_DEPRECATION_MESSAGE);
request.type(type); request.type(type);
}, new ParseField("type")); }, new ParseField("type"));
destParser.declareString(IndexRequest::routing, new ParseField("routing")); destParser.declareString(IndexRequest::routing, new ParseField("routing"));

View file

@ -51,6 +51,7 @@ import org.apache.lucene.search.similarities.NormalizationH3;
import org.apache.lucene.search.similarities.NormalizationZ; import org.apache.lucene.search.similarities.NormalizationZ;
import org.apache.lucene.search.similarity.LegacyBM25Similarity; import org.apache.lucene.search.similarity.LegacyBM25Similarity;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -142,8 +143,9 @@ final class SimilarityProviders {
throw new IllegalArgumentException("Basic model [" + basicModel + "] isn't supported anymore, " + throw new IllegalArgumentException("Basic model [" + basicModel + "] isn't supported anymore, " +
"please use another model."); "please use another model.");
} else { } else {
deprecationLogger.deprecate(basicModel + "_similarity_model_replaced", "Basic model [" + basicModel + deprecationLogger.deprecate(DeprecationCategory.QUERIES, basicModel + "_similarity_model_replaced",
"] isn't supported anymore and has arbitrarily been replaced with [" + replacement + "]."); "Basic model [" + basicModel + "] isn't supported anymore and has arbitrarily been replaced with ["
+ replacement + "].");
model = BASIC_MODELS.get(replacement); model = BASIC_MODELS.get(replacement);
assert model != null; assert model != null;
} }
@ -173,8 +175,9 @@ final class SimilarityProviders {
throw new IllegalArgumentException("After effect [" + afterEffect + throw new IllegalArgumentException("After effect [" + afterEffect +
"] isn't supported anymore, please use another effect."); "] isn't supported anymore, please use another effect.");
} else { } else {
deprecationLogger.deprecate(afterEffect + "_after_effect_replaced", "After effect [" + afterEffect + deprecationLogger.deprecate(DeprecationCategory.QUERIES, afterEffect + "_after_effect_replaced",
"] isn't supported anymore and has arbitrarily been replaced with [" + replacement + "]."); "After effect [" + afterEffect + "] isn't supported anymore and has arbitrarily been replaced with ["
+ replacement + "].");
effect = AFTER_EFFECTS.get(replacement); effect = AFTER_EFFECTS.get(replacement);
assert effect != null; assert effect != null;
} }
@ -263,7 +266,7 @@ final class SimilarityProviders {
if (version.onOrAfter(Version.V_7_0_0)) { if (version.onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException("Unknown settings for similarity of type [" + type + "]: " + unknownSettings); throw new IllegalArgumentException("Unknown settings for similarity of type [" + type + "]: " + unknownSettings);
} else { } else {
deprecationLogger.deprecate("unknown_similarity_setting", deprecationLogger.deprecate(DeprecationCategory.QUERIES, "unknown_similarity_setting",
"Unknown settings for similarity of type [" + type + "]: " + unknownSettings); "Unknown settings for similarity of type [" + type + "]: " + unknownSettings);
} }
} }

View file

@ -34,6 +34,7 @@ import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.TriFunction; import org.elasticsearch.common.TriFunction;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.AbstractIndexComponent;
@ -66,7 +67,7 @@ public final class SimilarityService extends AbstractIndexComponent {
} else { } else {
final ClassicSimilarity similarity = SimilarityProviders.createClassicSimilarity(Settings.EMPTY, version); final ClassicSimilarity similarity = SimilarityProviders.createClassicSimilarity(Settings.EMPTY, version);
return () -> { return () -> {
deprecationLogger.deprecate("classic_similarity", deprecationLogger.deprecate(DeprecationCategory.QUERIES, "classic_similarity",
"The [classic] similarity is now deprecated in favour of BM25, which is generally " "The [classic] similarity is now deprecated in favour of BM25, which is generally "
+ "accepted as a better alternative. Use the [BM25] similarity or build a custom [scripted] similarity " + "accepted as a better alternative. Use the [BM25] similarity or build a custom [scripted] similarity "
+ "instead."); + "instead.");
@ -90,7 +91,7 @@ public final class SimilarityService extends AbstractIndexComponent {
throw new IllegalArgumentException("The [classic] similarity may not be used anymore. Please use the [BM25] " throw new IllegalArgumentException("The [classic] similarity may not be used anymore. Please use the [BM25] "
+ "similarity or build a custom [scripted] similarity instead."); + "similarity or build a custom [scripted] similarity instead.");
} else { } else {
deprecationLogger.deprecate("classic_similarity", deprecationLogger.deprecate(DeprecationCategory.QUERIES, "classic_similarity",
"The [classic] similarity is now deprecated in favour of BM25, which is generally " "The [classic] similarity is now deprecated in favour of BM25, which is generally "
+ "accepted as a better alternative. Use the [BM25] similarity or build a custom [scripted] similarity " + "accepted as a better alternative. Use the [BM25] similarity or build a custom [scripted] similarity "
+ "instead."); + "instead.");
@ -155,7 +156,7 @@ public final class SimilarityService extends AbstractIndexComponent {
defaultSimilarity = (providers.get("default") != null) ? providers.get("default").get() defaultSimilarity = (providers.get("default") != null) ? providers.get("default").get()
: providers.get(SimilarityService.DEFAULT_SIMILARITY).get(); : providers.get(SimilarityService.DEFAULT_SIMILARITY).get();
if (providers.get("base") != null) { if (providers.get("base") != null) {
deprecationLogger.deprecate("base_similarity_ignored", deprecationLogger.deprecate(DeprecationCategory.QUERIES, "base_similarity_ignored",
"The [base] similarity is ignored since query normalization and coords have been removed"); "The [base] similarity is ignored since query normalization and coords have been removed");
} }
} }
@ -272,7 +273,7 @@ public final class SimilarityService extends AbstractIndexComponent {
if (indexCreatedVersion.onOrAfter(Version.V_7_0_0)) { if (indexCreatedVersion.onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException(message); throw new IllegalArgumentException(message);
} else if (indexCreatedVersion.onOrAfter(Version.V_6_5_0)) { } else if (indexCreatedVersion.onOrAfter(Version.V_6_5_0)) {
deprecationLogger.deprecate("similarity_failure", message); deprecationLogger.deprecate(DeprecationCategory.QUERIES, "similarity_failure", message);
} }
} }

View file

@ -24,6 +24,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.NamedRegistry; import org.elasticsearch.common.NamedRegistry;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
@ -124,7 +125,7 @@ public final class AnalysisModule {
@Override @Override
public TokenFilterFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) { public TokenFilterFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
if (indexSettings.getIndexVersionCreated().before(Version.V_7_0_0)) { if (indexSettings.getIndexVersionCreated().before(Version.V_7_0_0)) {
deprecationLogger.deprecate("standard_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "standard_deprecation",
"The [standard] token filter name is deprecated and will be removed in a future version."); "The [standard] token filter name is deprecated and will be removed in a future version.");
} else { } else {
throw new IllegalArgumentException("The [standard] token filter has been removed."); throw new IllegalArgumentException("The [standard] token filter has been removed.");
@ -185,7 +186,7 @@ public final class AnalysisModule {
// in certain circumstances to create a new index referencing the standard token filter // in certain circumstances to create a new index referencing the standard token filter
// until version 7_5_2 // until version 7_5_2
if (version.before(Version.V_7_6_0)) { if (version.before(Version.V_7_6_0)) {
deprecationLogger.deprecate("standard_deprecation", deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "standard_deprecation",
"The [standard] token filter is deprecated and will be removed in a future version."); "The [standard] token filter is deprecated and will be removed in a future version.");
} else { } else {
throw new IllegalArgumentException("The [standard] token filter has been removed."); throw new IllegalArgumentException("The [standard] token filter has been removed.");

View file

@ -41,6 +41,7 @@ import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
@ -160,7 +161,7 @@ public class SyncedFlushService implements IndexEventListener {
final ActionListener<SyncedFlushResponse> listener) { final ActionListener<SyncedFlushResponse> listener) {
final ClusterState state = clusterService.state(); final ClusterState state = clusterService.state();
if (state.nodes().getMinNodeVersion().onOrAfter(Version.V_7_6_0)) { if (state.nodes().getMinNodeVersion().onOrAfter(Version.V_7_6_0)) {
DEPRECATION_LOGGER.deprecate("synced_flush", SYNCED_FLUSH_DEPRECATION_MESSAGE); DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "synced_flush", SYNCED_FLUSH_DEPRECATION_MESSAGE);
} }
final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, indicesOptions, aliasesOrIndices); final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, indicesOptions, aliasesOrIndices);
final Map<String, List<ShardsSyncedFlushResult>> results = ConcurrentCollections.newConcurrentMap(); final Map<String, List<ShardsSyncedFlushResult>> results = ConcurrentCollections.newConcurrentMap();

View file

@ -19,6 +19,7 @@
package org.elasticsearch.ingest; package org.elasticsearch.ingest;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.script.DynamicMap; import org.elasticsearch.script.DynamicMap;
import org.elasticsearch.script.IngestConditionalScript; import org.elasticsearch.script.IngestConditionalScript;
@ -48,7 +49,7 @@ public class ConditionalProcessor extends AbstractProcessor implements WrappingP
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> FUNCTIONS = org.elasticsearch.common.collect.Map.of( private static final Map<String, Function<Object, Object>> FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"_type", value -> { "_type", value -> {
deprecationLogger.deprecate("conditional-processor__type", deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "conditional-processor__type",
"[types removal] Looking up doc types [_type] in scripts is deprecated."); "[types removal] Looking up doc types [_type] in scripts is deprecated.");
return value; return value;
}); });

View file

@ -72,6 +72,7 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.inject.ModulesBuilder;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.HeaderWarning; import org.elasticsearch.common.logging.HeaderWarning;
import org.elasticsearch.common.logging.NodeAndClusterIdStateListener; import org.elasticsearch.common.logging.NodeAndClusterIdStateListener;
@ -326,6 +327,7 @@ public class Node implements Closeable {
} else { } else {
logger.info("JVM home [{}]", System.getProperty("java.home")); logger.info("JVM home [{}]", System.getProperty("java.home"));
deprecationLogger.deprecate( deprecationLogger.deprecate(
DeprecationCategory.OTHER,
"no-jdk", "no-jdk",
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release"); "no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release");
} }

View file

@ -20,6 +20,7 @@ package org.elasticsearch.rest;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import java.util.Objects; import java.util.Objects;
@ -57,7 +58,7 @@ public class DeprecationRestHandler implements RestHandler {
*/ */
@Override @Override
public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
deprecationLogger.deprecate("deprecated_route", deprecationMessage); deprecationLogger.deprecate(DeprecationCategory.API, "deprecated_route", deprecationMessage);
handler.handleRequest(request, channel, client); handler.handleRequest(request, channel, client);
} }

View file

@ -24,6 +24,7 @@ import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
@ -64,7 +65,8 @@ public class RestCloseIndexAction extends BaseRestHandler {
closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions())); closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions()));
String waitForActiveShards = request.param("wait_for_active_shards"); String waitForActiveShards = request.param("wait_for_active_shards");
if (waitForActiveShards == null) { if (waitForActiveShards == null) {
deprecationLogger.deprecate("close-index-wait_for_active_shards-default", WAIT_FOR_ACTIVE_SHARDS_DEFAULT_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.API, "close-index-wait_for_active_shards-default",
WAIT_FOR_ACTIVE_SHARDS_DEFAULT_DEPRECATION_MESSAGE);
} else if ("index-setting".equalsIgnoreCase(waitForActiveShards)) { } else if ("index-setting".equalsIgnoreCase(waitForActiveShards)) {
closeIndexRequest.waitForActiveShards(ActiveShardCount.DEFAULT); closeIndexRequest.waitForActiveShards(ActiveShardCount.DEFAULT);
} else { } else {

View file

@ -22,6 +22,7 @@ package org.elasticsearch.rest.action.admin.indices;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentHelper;
@ -60,7 +61,7 @@ public class RestCreateIndexAction extends BaseRestHandler {
DEFAULT_INCLUDE_TYPE_NAME_POLICY); DEFAULT_INCLUDE_TYPE_NAME_POLICY);
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("create_index_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "create_index_with_types", TYPES_DEPRECATION_MESSAGE);
} }
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index")); CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));

View file

@ -23,6 +23,7 @@ import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
@ -59,7 +60,7 @@ public class RestForceMergeAction extends BaseRestHandler {
mergeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", mergeRequest.onlyExpungeDeletes())); mergeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", mergeRequest.onlyExpungeDeletes()));
mergeRequest.flush(request.paramAsBoolean("flush", mergeRequest.flush())); mergeRequest.flush(request.paramAsBoolean("flush", mergeRequest.flush()));
if (mergeRequest.onlyExpungeDeletes() && mergeRequest.maxNumSegments() != ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS) { if (mergeRequest.onlyExpungeDeletes() && mergeRequest.maxNumSegments() != ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS) {
deprecationLogger.deprecate("force_merge_expunge_deletes_and_max_num_segments_deprecation", deprecationLogger.deprecate(DeprecationCategory.API, "force_merge_expunge_deletes_and_max_num_segments_deprecation",
"setting only_expunge_deletes and max_num_segments at the same time is deprecated and will be rejected in a future version"); "setting only_expunge_deletes and max_num_segments at the same time is deprecated and will be rejected in a future version");
} }
return channel -> client.admin().indices().forceMerge(mergeRequest, new RestToXContentListener<>(channel)); return channel -> client.admin().indices().forceMerge(mergeRequest, new RestToXContentListener<>(channel));

View file

@ -27,6 +27,7 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRespon
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -80,7 +81,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
" is set to true."); " is set to true.");
} }
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("get_field_mapping_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_field_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
} }
GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest(); GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest();
@ -88,7 +89,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions())); getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions()));
if (request.hasParam("local")) { if (request.hasParam("local")) {
deprecationLogger.deprecate("get_field_mapping_local", deprecationLogger.deprecate(DeprecationCategory.API, "get_field_mapping_local",
"Use [local] in get field mapping requests is deprecated. " "Use [local] in get field mapping requests is deprecated. "
+ "The parameter will be removed in the next major version"); + "The parameter will be removed in the next major version");
} }

View file

@ -23,6 +23,7 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequ
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
@ -73,7 +74,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler {
final GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names); final GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("get_index_template_include_type_name", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_index_template_include_type_name", TYPES_DEPRECATION_MESSAGE);
} }
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local())); getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout())); getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));

View file

@ -24,6 +24,7 @@ import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -72,7 +73,7 @@ public class RestGetIndicesAction extends BaseRestHandler {
String[] indices = Strings.splitStringByCommaToArray(request.param("index")); String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
// starting with 7.0 we don't include types by default in the response to GET requests // starting with 7.0 we don't include types by default in the response to GET requests
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) && request.method().equals(GET)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) && request.method().equals(GET)) {
deprecationLogger.deprecate("get_indices_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_indices_with_types", TYPES_DEPRECATION_MESSAGE);
} }
final GetIndexRequest getIndexRequest = new GetIndexRequest(); final GetIndexRequest getIndexRequest = new GetIndexRequest();
getIndexRequest.indices(indices); getIndexRequest.indices(indices);

View file

@ -32,6 +32,7 @@ import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.cluster.metadata.MappingMetadata;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
@ -100,14 +101,14 @@ public class RestGetMappingAction extends BaseRestHandler {
boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY);
if (request.method().equals(HEAD)) { if (request.method().equals(HEAD)) {
deprecationLogger.deprecate("get_mapping_types_removal", deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_mapping_types_removal",
"Type exists requests are deprecated, as types have been deprecated."); "Type exists requests are deprecated, as types have been deprecated.");
} else if (includeTypeName == false && types.length > 0) { } else if (includeTypeName == false && types.length > 0) {
throw new IllegalArgumentException("Types cannot be provided in get mapping requests, unless" + throw new IllegalArgumentException("Types cannot be provided in get mapping requests, unless" +
" include_type_name is set to true."); " include_type_name is set to true.");
} }
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("get_mapping_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
} }
final GetMappingsRequest getMappingsRequest = new GetMappingsRequest(); final GetMappingsRequest getMappingsRequest = new GetMappingsRequest();

View file

@ -22,6 +22,7 @@ package org.elasticsearch.rest.action.admin.indices;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -64,10 +65,10 @@ public class RestPutIndexTemplateAction extends BaseRestHandler {
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name")); PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("put_index_template_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "put_index_template_with_types", TYPES_DEPRECATION_MESSAGE);
} }
if (request.hasParam("template")) { if (request.hasParam("template")) {
deprecationLogger.deprecate("put_index_template_deprecated_parameter", deprecationLogger.deprecate(DeprecationCategory.API, "put_index_template_deprecated_parameter",
"Deprecated parameter [template] used, replaced by [index_patterns]"); "Deprecated parameter [template] used, replaced by [index_patterns]");
putRequest.patterns(Collections.singletonList(request.param("template"))); putRequest.patterns(Collections.singletonList(request.param("template")));
} else { } else {

View file

@ -23,6 +23,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
@ -77,7 +78,7 @@ public class RestPutMappingAction extends BaseRestHandler {
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER,
DEFAULT_INCLUDE_TYPE_NAME_POLICY); DEFAULT_INCLUDE_TYPE_NAME_POLICY);
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("put_mapping_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "put_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
} }
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index"))); PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));

View file

@ -27,6 +27,7 @@ import org.elasticsearch.action.admin.indices.shrink.ResizeType;
import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
@ -71,7 +72,7 @@ public abstract class RestResizeHandler extends BaseRestHandler {
throw new IllegalArgumentException("parameter [copy_settings] can not be explicitly set to [false]"); throw new IllegalArgumentException("parameter [copy_settings] can not be explicitly set to [false]");
} }
} }
deprecationLogger.deprecate("resize_deprecated_parameter", deprecationLogger.deprecate(DeprecationCategory.API, "resize_deprecated_parameter",
"parameter [copy_settings] is deprecated and will be removed in 8.0.0"); "parameter [copy_settings] is deprecated and will be removed in 8.0.0");
} }
resizeRequest.setCopySettings(copySettings); resizeRequest.setCopySettings(copySettings);

View file

@ -22,6 +22,7 @@ package org.elasticsearch.rest.action.admin.indices;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
@ -56,7 +57,7 @@ public class RestRolloverIndexAction extends BaseRestHandler {
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); final boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY);
if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) {
deprecationLogger.deprecate("index_rollover_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "index_rollover_with_types", TYPES_DEPRECATION_MESSAGE);
} }
RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index")); RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index"));
request.applyContentParser(parser -> rolloverIndexRequest.fromXContent(includeTypeName, parser)); request.applyContentParser(parser -> rolloverIndexRequest.fromXContent(includeTypeName, parser));

View file

@ -26,6 +26,7 @@ import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -72,7 +73,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
validateQueryRequest.explain(request.paramAsBoolean("explain", false)); validateQueryRequest.explain(request.paramAsBoolean("explain", false));
if (request.hasParam("type")) { if (request.hasParam("type")) {
deprecationLogger.deprecate("validate_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "validate_query_with_types", TYPES_DEPRECATION_MESSAGE);
validateQueryRequest.types(Strings.splitStringByCommaToArray(request.param("type"))); validateQueryRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
} }

View file

@ -39,6 +39,7 @@ import org.elasticsearch.cluster.health.ClusterIndexHealth;
import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table; import org.elasticsearch.common.Table;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.time.DateFormatter; import org.elasticsearch.common.time.DateFormatter;
@ -101,7 +102,7 @@ public class RestIndicesAction extends AbstractCatAction {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index")); final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.strictExpand()); final IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.strictExpand());
if (request.hasParam("local")) { if (request.hasParam("local")) {
DEPRECATION_LOGGER.deprecate("local", LOCAL_DEPRECATED_MESSAGE); DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "local", LOCAL_DEPRECATED_MESSAGE);
} }
final boolean local = request.paramAsBoolean("local", false); final boolean local = request.paramAsBoolean("local", false);
final TimeValue masterNodeTimeout = request.paramAsTime("master_timeout", DEFAULT_MASTER_NODE_TIMEOUT); final TimeValue masterNodeTimeout = request.paramAsTime("master_timeout", DEFAULT_MASTER_NODE_TIMEOUT);

View file

@ -33,6 +33,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodeRole;
import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table; import org.elasticsearch.common.Table;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.network.NetworkAddress; import org.elasticsearch.common.network.NetworkAddress;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
@ -94,7 +95,7 @@ public class RestNodesAction extends AbstractCatAction {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true); clusterStateRequest.clear().nodes(true);
if (request.hasParam("local")) { if (request.hasParam("local")) {
deprecationLogger.deprecate("cat_nodes_local_parameter", LOCAL_DEPRECATED_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.API, "cat_nodes_local_parameter", LOCAL_DEPRECATED_MESSAGE);
} }
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

View file

@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table; import org.elasticsearch.common.Table;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.cache.query.QueryCacheStats; import org.elasticsearch.index.cache.query.QueryCacheStats;
@ -92,7 +93,7 @@ public class RestShardsAction extends AbstractCatAction {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index")); final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
if (request.hasParam("local")) { if (request.hasParam("local")) {
DEPRECATION_LOGGER.deprecate("local", LOCAL_DEPRECATED_MESSAGE); DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "local", LOCAL_DEPRECATED_MESSAGE);
} }
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

View file

@ -25,6 +25,7 @@ import org.elasticsearch.action.bulk.BulkShardRequest;
import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.Requests; import org.elasticsearch.client.Requests;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
@ -87,7 +88,7 @@ public class RestBulkAction extends BaseRestHandler {
if (defaultType == null) { if (defaultType == null) {
defaultType = MapperService.SINGLE_MAPPING_NAME; defaultType = MapperService.SINGLE_MAPPING_NAME;
} else { } else {
deprecationLogger.deprecate("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
} }
String defaultRouting = request.param("routing"); String defaultRouting = request.param("routing");
FetchSourceContext defaultFetchSourceContext = FetchSourceContext.parseFromRestRequest(request); FetchSourceContext defaultFetchSourceContext = FetchSourceContext.parseFromRestRequest(request);

View file

@ -22,6 +22,7 @@ package org.elasticsearch.rest.action.document;
import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -58,7 +59,7 @@ public class RestDeleteAction extends BaseRestHandler {
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
DeleteRequest deleteRequest; DeleteRequest deleteRequest;
if (request.hasParam("type")) { if (request.hasParam("type")) {
deprecationLogger.deprecate("delete_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "delete_with_types", TYPES_DEPRECATION_MESSAGE);
deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id")); deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
} else { } else {
deleteRequest = new DeleteRequest(request.param("index"), request.param("id")); deleteRequest = new DeleteRequest(request.param("index"), request.param("id"));

View file

@ -23,6 +23,7 @@ import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
@ -66,7 +67,7 @@ public class RestGetAction extends BaseRestHandler {
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
GetRequest getRequest; GetRequest getRequest;
if (request.hasParam("type")) { if (request.hasParam("type")) {
deprecationLogger.deprecate("get_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_with_types", TYPES_DEPRECATION_MESSAGE);
getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id")); getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
} else { } else {
getRequest = new GetRequest(request.param("index"), request.param("id")); getRequest = new GetRequest(request.param("index"), request.param("id"));

Some files were not shown because too many files have changed in this diff Show more