Change default deprecation logger level to CRITICAL backport(#77030) (#77482)

This commit changes default deprecation logger level to CRITICAL, where default means deprecations emitted by DeprecationLogger#critical method.
It also introduces WARN deprecations which are emitted by DeprecationLogger#warn Those log lines emitted at WARN are meant to indicate that a functionality is deprecated but will not break at next major version.
relates #76754
This commit is contained in:
Przemyslaw Gomulka 2021-09-27 13:43:16 +02:00 committed by GitHub
parent 6cccbf55c3
commit 4ef3a58a46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
195 changed files with 509 additions and 365 deletions

View file

@ -93,7 +93,7 @@ appender.deprecation_rolling_old.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling_old.strategy.max = 4 appender.deprecation_rolling_old.strategy.max = 4
################################################# #################################################
logger.deprecation.name = org.elasticsearch.deprecation logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = deprecation logger.deprecation.level = WARN
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old
logger.deprecation.appenderRef.header_warning.ref = header_warning logger.deprecation.appenderRef.header_warning.ref = header_warning

View file

@ -200,12 +200,12 @@ By default, {es} rolls and compresses deprecation logs at 1GB. The default
configuration preserves a maximum of five log files: four rolled logs and an configuration preserves a maximum of five log files: four rolled logs and an
active log. active log.
{es} emits deprecation log messages at the `DEPRECATION` level. To stop writing {es} emits deprecation log messages at the `CRITICAL` level. To stop writing
deprecation log messages, set `logger.deprecation.level` to `error`: deprecation log messages, set `logger.deprecation.level` to `OFF`:
[source,properties] [source,properties]
---- ----
logger.deprecation.level = error logger.deprecation.level = OFF
---- ----
You can identify what is triggering deprecated functionality if `X-Opaque-Id` was used as an HTTP header. You can identify what is triggering deprecated functionality if `X-Opaque-Id` was used as an HTTP header.

View file

@ -92,7 +92,7 @@ public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
"] cannot be used to parse synonyms"); "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.critical(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

@ -239,7 +239,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(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation", deprecationLogger.critical(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);
@ -264,7 +264,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(DeprecationCategory.ANALYSIS, "nGram_deprecation", deprecationLogger.critical(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);
@ -313,7 +313,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(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", deprecationLogger.critical(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.");
} }
@ -322,7 +322,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(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", deprecationLogger.critical(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.");
} }
@ -403,7 +403,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(DeprecationCategory.ANALYSIS, "htmlStrip_deprecation", deprecationLogger.critical(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.");
} }
@ -434,7 +434,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(DeprecationCategory.ANALYSIS, "analysis_delimited_payload_filter", deprecationLogger.critical(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,
@ -454,7 +454,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(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation", deprecationLogger.critical(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.");
} }
@ -481,7 +481,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(DeprecationCategory.ANALYSIS, "nGram_deprecation", deprecationLogger.critical(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.");
} }
@ -559,7 +559,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(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", deprecationLogger.critical(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.");
} }
@ -567,7 +567,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(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", deprecationLogger.critical(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

@ -59,7 +59,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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.critical(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

@ -81,7 +81,7 @@ 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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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

@ -48,7 +48,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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter [" + name() DEPRECATION_LOGGER.critical(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

@ -27,7 +27,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(DeprecationCategory.ANALYSIS, "analysis_legacy_delimited_payload_filter", deprecationLogger.critical(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

@ -56,7 +56,7 @@ public class MultiplexerTokenFilterFactory extends AbstractTokenFilterFactory {
} }
else { else {
if (preserveOriginal) { if (preserveOriginal) {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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;
} }
@ -119,7 +119,7 @@ public class MultiplexerTokenFilterFactory extends AbstractTokenFilterFactory {
} }
else { else {
if (preserveOriginal) { if (preserveOriginal) {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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;
} }

View file

@ -42,7 +42,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(DeprecationCategory.ANALYSIS, "ngram_big_difference", deprecationLogger.critical(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 + "]");
} }
@ -61,7 +61,7 @@ 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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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

@ -108,7 +108,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(DeprecationCategory.ANALYSIS, "ngram_big_difference", deprecationLogger.critical(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

@ -38,7 +38,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(DeprecationCategory.ANALYSIS, "standard_html_strip_deprecation", DEPRECATION_LOGGER.critical(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

@ -47,7 +47,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(DeprecationCategory.ANALYSIS, "synonym_ignore_case_option", DEPRECATION_LOGGER.critical(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

@ -102,7 +102,7 @@ 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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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

@ -105,7 +105,7 @@ 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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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

@ -45,7 +45,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.core.Map.of( private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.core.Map.of(
"_type", value -> { "_type", value -> {
deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "script_processor", deprecationLogger.critical(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

@ -330,7 +330,7 @@ public class UserAgentProcessor extends AbstractProcessor {
} }
if (useECS == false) { if (useECS == false) {
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ecs_false_non_common_schema", deprecationLogger.critical(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");
} }
@ -383,7 +383,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(DeprecationCategory.PARSING, key, deprecationLogger.critical(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

@ -74,7 +74,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(DeprecationCategory.TYPES, "msearch_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "msearch_with_types", TYPES_DEPRECATION_MESSAGE);
break; break;
} }
} }

View file

@ -131,7 +131,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(DeprecationCategory.QUERIES, "min_children", MIN_CHILDREN_0_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -458,7 +458,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
} }
GetRequest getRequest; GetRequest getRequest;
if (indexedDocumentType != null) { if (indexedDocumentType != null) {
deprecationLogger.deprecate(DeprecationCategory.TYPES, "percolate_with_type", TYPE_DEPRECATION_MESSAGE); deprecationLogger.critical(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);
@ -527,7 +527,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(DeprecationCategory.TYPES, "percolate_with_document_type", DOCUMENT_TYPE_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -56,7 +56,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(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE); deprecationLogger.critical(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE);
} }
} }

View file

@ -174,7 +174,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(DeprecationCategory.API, "reindex_url_encoded_index", DEPRECATED_URL_ENCODED_INDEX_WARNING); DEPRECATION_LOGGER.critical(DeprecationCategory.API, "reindex_url_encoded_index", DEPRECATED_URL_ENCODED_INDEX_WARNING);
return s; return s;
} }
try { try {

View file

@ -50,7 +50,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(DeprecationCategory.ANALYSIS, "icu_normalizer_unicode_set_filter", deprecationLogger.critical(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

@ -140,7 +140,7 @@ 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(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters",
"Token filter [" + name() + "] 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

@ -38,7 +38,7 @@ public class AzureDiscoveryPlugin extends Plugin implements DiscoveryPlugin {
public AzureDiscoveryPlugin(Settings settings) { public AzureDiscoveryPlugin(Settings settings) {
this.settings = settings; this.settings = settings;
deprecationLogger.deprecate(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated."); deprecationLogger.critical(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

@ -125,12 +125,12 @@ final class Ec2ClientSettings {
return null; return null;
} else { } else {
if (key.length() == 0) { if (key.length() == 0) {
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ec2_invalid_settings", deprecationLogger.critical(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(DeprecationCategory.SETTINGS, "ec2_invalid_settings", deprecationLogger.critical(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

@ -244,7 +244,7 @@ class S3Repository extends MeteredBlobStoreRepository {
if (S3ClientSettings.checkDeprecatedCredentials(metadata.settings())) { if (S3ClientSettings.checkDeprecatedCredentials(metadata.settings())) {
// provided repository settings // provided repository settings
deprecationLogger.deprecate(DeprecationCategory.SECURITY, "s3_repository_secret_settings", deprecationLogger.critical(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

@ -21,10 +21,10 @@ import org.apache.lucene.util.Constants;
import org.elasticsearch.cli.UserException; import org.elasticsearch.cli.UserException;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.Randomness; import org.elasticsearch.common.Randomness;
import org.elasticsearch.core.PathUtils;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.core.PathUtils;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
@ -46,7 +46,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import static org.elasticsearch.common.logging.DeprecationLogger.DEPRECATION;
import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItem;
@ -117,7 +116,7 @@ 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(DeprecationCategory.OTHER, Integer.toString(id), deprecationLogger.critical(DeprecationCategory.OTHER, Integer.toString(id),
"This is a maybe logged deprecation message" + id); "This is a maybe logged deprecation message" + id);
} }
} }
@ -166,8 +165,8 @@ public class EvilLoggerTests extends ESTestCase {
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
assertLogLine( assertLogLine(
deprecationEvents.get(i), deprecationEvents.get(i),
DEPRECATION, DeprecationLogger.CRITICAL,
"org.elasticsearch.common.logging.DeprecationLogger.deprecate", "org.elasticsearch.common.logging.DeprecationLogger.logDeprecation",
"This is a maybe logged deprecation message" + i); "This is a maybe logged deprecation message" + i);
} }
@ -199,8 +198,8 @@ public class EvilLoggerTests extends ESTestCase {
assertThat(deprecationEvents.size(), equalTo(1)); assertThat(deprecationEvents.size(), equalTo(1));
assertLogLine( assertLogLine(
deprecationEvents.get(0), deprecationEvents.get(0),
DEPRECATION, DeprecationLogger.CRITICAL,
"org.elasticsearch.common.logging.DeprecationLogger.deprecate", "org.elasticsearch.common.logging.DeprecationLogger.logDeprecation",
"\\[deprecated.foo\\] setting was deprecated in Elasticsearch and will be removed in a future release! " + "\\[deprecated.foo\\] setting was deprecated in Elasticsearch and will be removed in a future release! " +
"See the breaking changes documentation for the next major version."); "See the breaking changes documentation for the next major version.");
} }

View file

@ -47,7 +47,8 @@ import static org.hamcrest.core.IsEqual.equalTo;
/** /**
* This test confirms JSON log structure is properly formatted and can be parsed. * This test confirms JSON log structure is properly formatted and can be parsed.
* It has to be in a <code>org.elasticsearch.common.logging</code> package to use <code>PrefixLogger</code> * It has to be in a <code>org.elasticsearch.common.logging</code> package to use <code>PrefixLogger</code>.
* When running from IDE set -Dtests.security.manager=false
*/ */
public class JsonLoggerTests extends ESTestCase { public class JsonLoggerTests extends ESTestCase {
@ -73,6 +74,54 @@ public class JsonLoggerTests extends ESTestCase {
super.tearDown(); super.tearDown();
} }
public void testDeprecationWarnMessage() throws IOException {
final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test");
testLogger.warn(DeprecationCategory.OTHER, "a key", "deprecated warn message1");
final Path path = PathUtils.get(System.getProperty("es.logs.base_path"),
System.getProperty("es.logs.cluster_name") + "_deprecated.json");
try (Stream<Map<String, String>> stream = JsonLogsStream.mapStreamFrom(path)) {
List<Map<String, String>> jsonLogs = stream
.collect(Collectors.toList());
assertThat(jsonLogs, contains(
allOf(
hasEntry("level", "WARN"),
hasEntry("component", "o.e.d.test"),
hasEntry("message", "deprecated warn message1")
))
);
}
assertWarnings("deprecated warn message1");
}
public void testDeprecatedMessageWithoutXOpaqueId() throws IOException {
final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test");
testLogger.critical(DeprecationCategory.OTHER, "a key", "deprecated message1");
final Path path = PathUtils.get(System.getProperty("es.logs.base_path"),
System.getProperty("es.logs.cluster_name") + "_deprecated.json");
try (Stream<Map<String, String>> stream = JsonLogsStream.mapStreamFrom(path)) {
List<Map<String, String>> jsonLogs = stream
.collect(Collectors.toList());
assertThat(jsonLogs, contains(
allOf(
hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message1"),
not(hasKey("x-opaque-id"))
)
));
}
assertWarnings("deprecated message1");
}
public void testParseFieldEmittingDeprecatedLogs() throws Exception { public void testParseFieldEmittingDeprecatedLogs() throws Exception {
@ -100,7 +149,7 @@ public class JsonLoggerTests extends ESTestCase {
// deprecation log for field deprecated_name // deprecation log for field deprecated_name
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.c.x.ParseField"), hasEntry("component", "o.e.d.c.x.ParseField"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),
@ -111,7 +160,7 @@ public class JsonLoggerTests extends ESTestCase {
), ),
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.c.x.ParseField"), hasEntry("component", "o.e.d.c.x.ParseField"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),
@ -135,7 +184,7 @@ public class JsonLoggerTests extends ESTestCase {
threadContext.putHeader(Task.X_OPAQUE_ID, "someId"); threadContext.putHeader(Task.X_OPAQUE_ID, "someId");
threadContext.putHeader(Task.TRACE_ID, "someTraceId"); threadContext.putHeader(Task.TRACE_ID, "someTraceId");
final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test");
testLogger.deprecate(DeprecationCategory.OTHER, "someKey", "deprecated message1"); testLogger.critical(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"),
@ -150,7 +199,7 @@ public class JsonLoggerTests extends ESTestCase {
contains( contains(
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.test"), hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),
@ -166,31 +215,6 @@ public class JsonLoggerTests extends ESTestCase {
}); });
} }
public void testDeprecatedMessageWithoutXOpaqueId() throws IOException {
final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test");
testLogger.deprecate(DeprecationCategory.OTHER, "a key", "deprecated message1");
final Path path = PathUtils.get(System.getProperty("es.logs.base_path"),
System.getProperty("es.logs.cluster_name") + "_deprecated.json");
try (Stream<Map<String, String>> stream = JsonLogsStream.mapStreamFrom(path)) {
List<Map<String, String>> jsonLogs = stream
.collect(Collectors.toList());
assertThat(jsonLogs, contains(
allOf(
hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"),
hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message1"),
not(hasKey("x-opaque-id"))
)
));
}
assertWarnings("deprecated message1");
}
public void testJsonLayout() throws IOException { public void testJsonLayout() throws IOException {
final Logger testLogger = LogManager.getLogger("test"); final Logger testLogger = LogManager.getLogger("test");
@ -303,15 +327,14 @@ public class JsonLoggerTests extends ESTestCase {
} }
} }
public void testDuplicateLogMessages() throws Exception { public void testDuplicateLogMessages() throws Exception {
final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger("org.elasticsearch.test");
// 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(DeprecationCategory.OTHER, "key", "message1"); deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2"); deprecationLogger.critical(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"),
@ -323,7 +346,7 @@ public class JsonLoggerTests extends ESTestCase {
assertThat(jsonLogs, contains( assertThat(jsonLogs, contains(
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.test"), hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),
@ -341,8 +364,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(DeprecationCategory.OTHER, "key", "message1"); deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2"); deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message2");
assertWarnings("message1", "message2"); assertWarnings("message1", "message2");
final Path path = PathUtils.get( final Path path = PathUtils.get(
@ -357,7 +380,7 @@ public class JsonLoggerTests extends ESTestCase {
contains( contains(
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.test"), hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),
@ -366,7 +389,7 @@ public class JsonLoggerTests extends ESTestCase {
), ),
allOf( allOf(
hasEntry("type", "deprecation.elasticsearch"), hasEntry("type", "deprecation.elasticsearch"),
hasEntry("level", "DEPRECATION"), hasEntry("level", "CRITICAL"),
hasEntry("component", "o.e.d.test"), hasEntry("component", "o.e.d.test"),
hasEntry("cluster.name", "elasticsearch"), hasEntry("cluster.name", "elasticsearch"),
hasEntry("node.name", "sample-name"), hasEntry("node.name", "sample-name"),

View file

@ -47,7 +47,7 @@ appender.header_warning.type = HeaderWarningAppender
appender.header_warning.name = header_warning appender.header_warning.name = header_warning
logger.deprecation.name = org.elasticsearch.deprecation logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = deprecation logger.deprecation.level = WARN
logger.deprecation.appenderRef.console.ref = console logger.deprecation.appenderRef.console.ref = console
logger.deprecation.appenderRef.file.ref = file logger.deprecation.appenderRef.file.ref = file
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecated logger.deprecation.appenderRef.deprecation_rolling.ref = deprecated

View file

@ -364,7 +364,7 @@ public class SystemIndicesSnapshotIT extends AbstractSnapshotIntegTestCase {
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"restore-system-index-from-snapshot", "restore-system-index-from-snapshot",
"org.elasticsearch.deprecation.snapshots.RestoreService", "org.elasticsearch.deprecation.snapshots.RestoreService",
DeprecationLogger.DEPRECATION, DeprecationLogger.CRITICAL,
"Restoring system indices by name is deprecated. Use feature states instead. System indices: [.test-system-idx]" "Restoring system indices by name is deprecated. Use feature states instead. System indices: [.test-system-idx]"
) )
); );

View file

@ -472,7 +472,7 @@ public class ActionModule extends AbstractModule {
} }
restWrapper = newRestWrapper; restWrapper = newRestWrapper;
if ("org.elasticsearch.xpack.security.Security".equals(plugin.getClass().getCanonicalName()) == false) { if ("org.elasticsearch.xpack.security.Security".equals(plugin.getClass().getCanonicalName()) == false) {
deprecationLogger.deprecate(DeprecationCategory.PLUGINS, "3rd_party_rest_deprecation", "The " + deprecationLogger.critical(DeprecationCategory.PLUGINS, "3rd_party_rest_deprecation", "The " +
plugin.getClass().getName() + " plugin installs a custom REST wrapper. This functionality is deprecated and will " + plugin.getClass().getName() + " plugin installs a custom REST wrapper. This functionality is deprecated and will " +
"not be possible in Elasticsearch 8.0. If this plugin is intended to provide security features for Elasticsearch " + "not be possible in Elasticsearch 8.0. If this plugin is intended to provide security features for Elasticsearch " +
"then you should switch to using the built-in Elasticsearch features instead."); "then you should switch to using the built-in Elasticsearch features instead.");

View file

@ -72,7 +72,7 @@ public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotin
} }
if (nodeDescriptions.length > 0) { if (nodeDescriptions.length > 0) {
deprecationLogger.deprecate(DeprecationCategory.API, "voting_config_exclusion", DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.API, "voting_config_exclusion", DEPRECATION_MESSAGE);
} }
this.nodeDescriptions = nodeDescriptions; this.nodeDescriptions = nodeDescriptions;
@ -94,7 +94,7 @@ public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotin
timeout = in.readTimeValue(); timeout = in.readTimeValue();
if (nodeDescriptions.length > 0) { if (nodeDescriptions.length > 0) {
deprecationLogger.deprecate(DeprecationCategory.API, "voting_config_exclusion", deprecationLogger.critical(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

@ -530,7 +530,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
if ((entry.getValue() instanceof Map) == false) { if ((entry.getValue() instanceof Map) == false) {
throw new IllegalArgumentException("malformed settings section"); throw new IllegalArgumentException("malformed settings section");
} }
DEPRECATION_LOGGER.deprecate( DEPRECATION_LOGGER.critical(
DeprecationCategory.API, DeprecationCategory.API,
"RestoreSnapshotRequest#settings", "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"

View file

@ -149,7 +149,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
} }
} }
if (systemIndicesNames.isEmpty() == false) { if (systemIndicesNames.isEmpty() == false) {
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", deprecationLogger.critical(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);
} }
@ -185,7 +185,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
} }
if (systemAliases.isEmpty() == false) { if (systemAliases.isEmpty() == false) {
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_alias_access", deprecationLogger.critical(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

@ -75,7 +75,7 @@ public class TransportAutoPutMappingAction extends AcknowledgedTransportMasterNo
final String message = TransportPutMappingAction.checkForSystemIndexViolations(systemIndices, concreteIndices, request); final String message = TransportPutMappingAction.checkForSystemIndexViolations(systemIndices, concreteIndices, request);
if (message != null) { if (message != null) {
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", message); deprecationLogger.critical(DeprecationCategory.API, "open_system_index_access", message);
} }
performMappingUpdate(concreteIndices, request, listener, metadataMappingService); performMappingUpdate(concreteIndices, request, listener, metadataMappingService);

View file

@ -93,7 +93,7 @@ public class TransportPutMappingAction extends AcknowledgedTransportMasterNodeAc
final String message = checkForSystemIndexViolations(systemIndices, concreteIndices, request); final String message = checkForSystemIndexViolations(systemIndices, concreteIndices, request);
if (message != null) { if (message != null) {
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", message); deprecationLogger.critical(DeprecationCategory.API, "open_system_index_access", message);
} }
performMappingUpdate(concreteIndices, request, listener, metadataMappingService); performMappingUpdate(concreteIndices, request, listener, metadataMappingService);

View file

@ -91,7 +91,7 @@ public class TransportUpdateSettingsAction extends AcknowledgedTransportMasterNo
.map(entry -> "[" + entry.getKey() + "] -> " + entry.getValue()) .map(entry -> "[" + entry.getKey() + "] -> " + entry.getValue())
.collect(Collectors.joining(", ")) .collect(Collectors.joining(", "))
+ ". This will not work in the next major version"; + ". This will not work in the next major version";
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", message); deprecationLogger.critical(DeprecationCategory.API, "open_system_index_access", message);
} }
final List<String> hiddenSystemIndexViolations final List<String> hiddenSystemIndexViolations

View file

@ -326,7 +326,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(DeprecationCategory.API, "put_index_template_field", deprecationLogger.critical(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

@ -199,7 +199,7 @@ 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(DeprecationCategory.TYPES, "bulk_with_types", deprecationLogger.critical(DeprecationCategory.TYPES, "bulk_with_types",
RestBulkAction.TYPES_DEPRECATION_MESSAGE); RestBulkAction.TYPES_DEPRECATION_MESSAGE);
typesDeprecationLogged = true; typesDeprecationLogged = true;
} }

View file

@ -175,7 +175,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(DeprecationCategory.TYPES, "simulate_pipeline_with_types", deprecationLogger.critical(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

@ -185,7 +185,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(DeprecationCategory.API, "multi_search_empty_first_line", deprecationLogger.critical(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

@ -85,7 +85,7 @@ public final class DestructiveOperations {
private void checkWildCardOK() { private void checkWildCardOK() {
if (this.isDestructiveRequiresNameSet == false) { if (this.isDestructiveRequiresNameSet == false) {
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, DeprecationCategory.SETTINGS,
"destructive_requires_name_default", "destructive_requires_name_default",
DESTRUCTIVE_REQUIRES_NAME_DEPRECATION_WARNING DESTRUCTIVE_REQUIRES_NAME_DEPRECATION_WARNING

View file

@ -324,7 +324,7 @@ public class IndicesOptions implements ToXContentFragment {
public static IndicesOptions fromRequest(RestRequest request, IndicesOptions defaultSettings) { public static IndicesOptions fromRequest(RestRequest request, IndicesOptions defaultSettings) {
if (request.hasParam("ignore_throttled")) { if (request.hasParam("ignore_throttled")) {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.API, "ignore_throttled_param", IGNORE_THROTTLED_DEPRECATION_MESSAGE); DEPRECATION_LOGGER.critical(DeprecationCategory.API, "ignore_throttled_param", IGNORE_THROTTLED_DEPRECATION_MESSAGE);
} }
return fromParameters( return fromParameters(

View file

@ -605,7 +605,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(DeprecationCategory.TYPES, "termvectors_with_types", deprecationLogger.critical(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

@ -358,7 +358,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(DeprecationCategory.OTHER, "java_version_11_required", message); DeprecationLogger.getLogger(Bootstrap.class).critical(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(
@ -366,7 +366,7 @@ 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(DeprecationCategory.SETTINGS, DeprecationLogger.getLogger(Bootstrap.class).critical(DeprecationCategory.SETTINGS,
"strict_duplicate_detection_setting_removed", message); "strict_duplicate_detection_setting_removed", message);
} }
if (environment.pidFile() != null) { if (environment.pidFile() != null) {

View file

@ -343,7 +343,7 @@ public class IndexNameExpressionResolver {
if (resolvedSystemIndices.isEmpty() == false) { if (resolvedSystemIndices.isEmpty() == false) {
Collections.sort(resolvedSystemIndices); Collections.sort(resolvedSystemIndices);
deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", deprecationLogger.critical(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

@ -92,7 +92,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(DeprecationCategory.TEMPLATES, "index-templates", deprecationLogger.critical(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

@ -208,7 +208,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(DeprecationCategory.INDICES, "index_name_starts_with_dot", DEPRECATION_LOGGER.critical(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);
} }
@ -366,7 +366,7 @@ public class MetadataCreateIndexService {
request.index(), isHiddenFromRequest); request.index(), isHiddenFromRequest);
if (v1Templates.size() > 1) { if (v1Templates.size() > 1) {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.TEMPLATES, "index_template_multiple_match", DEPRECATION_LOGGER.critical(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(", ")));
} }
@ -844,7 +844,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(DeprecationCategory.SETTINGS, "soft_deletes_disabled", DEPRECATION_LOGGER.critical(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() + "].");
} }
@ -1338,7 +1338,7 @@ 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( DEPRECATION_LOGGER.critical(
DeprecationCategory.SETTINGS, DeprecationCategory.SETTINGS,
"translog_retention", "translog_retention",
"Translog retention settings [index.translog.retention.age] " "Translog retention settings [index.translog.retention.age] "
@ -1350,7 +1350,7 @@ public class MetadataCreateIndexService {
public static void validateStoreTypeSetting(Settings indexSettings) { public static void validateStoreTypeSetting(Settings indexSettings) {
final String storeType = IndexModule.INDEX_STORE_TYPE_SETTING.get(indexSettings); final String storeType = IndexModule.INDEX_STORE_TYPE_SETTING.get(indexSettings);
if (IndexModule.Type.SIMPLEFS.match(storeType)) { if (IndexModule.Type.SIMPLEFS.match(storeType)) {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.SETTINGS, "store_type_setting", DEPRECATION_LOGGER.critical(DeprecationCategory.SETTINGS, "store_type_setting",
"[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " + "[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " +
"Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type as it offers superior " + "Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type as it offers superior " +
"or equivalent performance to [simplefs]."); "or equivalent performance to [simplefs].");

View file

@ -56,7 +56,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(DeprecationCategory.SETTINGS, "searches_not_routed_on_awareness_attributes", deprecationLogger.critical(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,
@ -81,7 +81,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(DeprecationCategory.SETTINGS, "searches_not_routed_on_awareness_attributes", deprecationLogger.critical(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

@ -94,7 +94,7 @@ 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( deprecationLogger.critical(
DeprecationCategory.SETTINGS, 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 {}",
@ -319,7 +319,7 @@ public class DiskThresholdMonitor {
logger.info("releasing read-only-allow-delete block on indices: [{}]", indicesToAutoRelease); logger.info("releasing read-only-allow-delete block on indices: [{}]", indicesToAutoRelease);
updateIndicesReadOnly(indicesToAutoRelease, listener, false); updateIndicesReadOnly(indicesToAutoRelease, listener, false);
} else { } else {
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, 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 {}",

View file

@ -84,7 +84,7 @@ public class DiskThresholdDecider extends AllocationDecider {
@Override @Override
public void validate(Boolean value, Map<Setting<?>, Object> settings, boolean isPresent) { public void validate(Boolean value, Map<Setting<?>, Object> settings, boolean isPresent) {
if (value == Boolean.FALSE && isPresent) { if (value == Boolean.FALSE && isPresent) {
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "watermark_enable_for_single_data_node", deprecationLogger.critical(DeprecationCategory.SETTINGS, "watermark_enable_for_single_data_node",
"setting [{}=false] is deprecated and will not be available in a future version", "setting [{}=false] is deprecated and will not be available in a future version",
ENABLE_FOR_SINGLE_DATA_NODE.getKey()); ENABLE_FOR_SINGLE_DATA_NODE.getKey());
} }

View file

@ -45,7 +45,7 @@ public enum SpatialStrategy implements Writeable {
return strategy; return strategy;
} }
} }
logger.deprecate(DeprecationCategory.OTHER, "geo_strategy", logger.critical(DeprecationCategory.OTHER, "geo_strategy",
"Unrecognised strategy [" + strategyName + "], falling back to [recursive]"); "Unrecognised strategy [" + strategyName + "], falling back to [recursive]");
return null; return null;
} }

View file

@ -65,7 +65,7 @@ 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(DeprecationCategory.PARSING,"camelCaseDateFormat", msg, formatName.getCamelCaseName(), .critical(DeprecationCategory.PARSING,"camelCaseDateFormat", msg, formatName.getCamelCaseName(),
formatName.getSnakeCaseName()); formatName.getSnakeCaseName());
} }
@ -150,7 +150,7 @@ public class Joda {
formatter = ISODateTimeFormat.weekDateTimeNoMillis(); formatter = ISODateTimeFormat.weekDateTimeNoMillis();
} else if (FormatNames.WEEKYEAR.matches(input)) { } else if (FormatNames.WEEKYEAR.matches(input)) {
getDeprecationLogger() getDeprecationLogger()
.deprecate(DeprecationCategory.PARSING, "week_year_format_name", .critical(DeprecationCategory.PARSING, "week_year_format_name",
"Format name \"week_year\" is deprecated and will be removed in a future version. 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)) {
@ -280,7 +280,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(DeprecationCategory.PARSING, "joda-pattern-deprecation", getDeprecationLogger().critical(DeprecationCategory.PARSING, "joda-pattern-deprecation",
suggestion + " " + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS); suggestion + " " + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS);
} }
} }
@ -390,11 +390,11 @@ 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(DeprecationCategory.PARSING, "epoch-negative", "Use of negative values" + getDeprecationLogger().critical(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(DeprecationCategory.PARSING, "epoch-scientific-notation", getDeprecationLogger().critical(DeprecationCategory.PARSING, "epoch-scientific-notation",
"Use of scientific notation in epoch time formats is deprecated and will not be supported in the " "Use of scientific notation in epoch time formats is deprecated and will not be supported in the "
+ "next major version of Elasticsearch."); + "next major version of Elasticsearch.");
} }

View file

@ -13,12 +13,12 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
/** /**
* A logger that logs deprecation notices. Logger should be initialized with a parent logger which name will be used * A logger that logs deprecation notices. Logger should be initialized with a class or name which will be used
* for deprecation logger. For instance <code>DeprecationLogger.getLogger("org.elasticsearch.test.SomeClass")</code> will * for deprecation logger. For instance <code>DeprecationLogger.getLogger("org.elasticsearch.test.SomeClass")</code> will
* result in a deprecation logger with name <code>org.elasticsearch.deprecation.test.SomeClass</code>. This allows to use a * result in a deprecation logger with name <code>org.elasticsearch.deprecation.test.SomeClass</code>. This allows to use a
* <code>deprecation</code> logger defined in log4j2.properties. * <code>deprecation</code> logger defined in log4j2.properties.
* <p> * <p>
* Logs are emitted at the custom {@link #DEPRECATION} level, and routed wherever they need to go using log4j. For example, * Logs are emitted at the custom {@link #CRITICAL} level, and routed wherever they need to go using log4j. For example,
* to disk using a rolling file appender, or added as a response header using {@link HeaderWarningAppender}. * to disk using a rolling file appender, or added as a response header using {@link HeaderWarningAppender}.
* <p> * <p>
* Deprecation messages include a <code>key</code>, which is used for rate-limiting purposes. The log4j configuration * Deprecation messages include a <code>key</code>, which is used for rate-limiting purposes. The log4j configuration
@ -27,18 +27,15 @@ import org.apache.logging.log4j.Logger;
* message limiting. * message limiting.
*/ */
public class DeprecationLogger { public class DeprecationLogger {
/** /**
* Deprecation messages are logged at this level. * Deprecation messages are logged at this level.
* More serious than WARN by 1, but less serious than ERROR
*/ */
public static Level DEPRECATION = Level.forName("DEPRECATION", Level.WARN.intLevel() + 1); public static Level CRITICAL = Level.forName("CRITICAL", Level.WARN.intLevel() - 1);
private final Logger logger; private final Logger logger;
private DeprecationLogger(Logger parentLogger) {
this.logger = parentLogger;
}
/** /**
* Creates a new deprecation logger for the supplied class. Internally, it delegates to * Creates a new deprecation logger for the supplied class. Internally, it delegates to
* {@link #getLogger(String)}, passing the full class name. * {@link #getLogger(String)}, passing the full class name.
@ -76,17 +73,38 @@ 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 DeprecationLogger#CRITICAL} level.
* This log will indicate that a change will break in next version.
* 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 DeprecationLogger deprecate( public DeprecationLogger critical(
final DeprecationCategory category, final DeprecationCategory category,
final String key, final String key,
final String msg, final String msg,
final Object... params final Object... params) {
) { return logDeprecation(CRITICAL, category, key, msg, params);
}
/**
* Logs a message at the {@link Level#WARN} level for less critical deprecations
* that won't break in next version.
* The message is also sent to the header warning logger,
* so that it can be returned to the client.
*/
public DeprecationLogger warn(
final DeprecationCategory category,
final String key,
final String msg,
final Object... params) {
return logDeprecation(Level.WARN, category, key, msg, params);
}
private DeprecationLogger logDeprecation(Level level, DeprecationCategory category, String key, String msg, Object[] params) {
ESLogMessage deprecationMessage = new DeprecatedMessage(category, key, HeaderWarning.getXOpaqueId(), msg, params); ESLogMessage deprecationMessage = new DeprecatedMessage(category, key, HeaderWarning.getXOpaqueId(), msg, params);
logger.log(DEPRECATION, deprecationMessage); logger.log(level, deprecationMessage);
return this; return this;
} }
} }

View file

@ -565,7 +565,7 @@ public class Setting<T> implements ToXContentObject {
DeprecationCategory category = this.isSecure(settings) ? DeprecationCategory.SECURITY : DeprecationCategory.SETTINGS; DeprecationCategory category = this.isSecure(settings) ? DeprecationCategory.SECURITY : DeprecationCategory.SETTINGS;
Settings.DeprecationLoggerHolder.deprecationLogger Settings.DeprecationLoggerHolder.deprecationLogger
.deprecate(category, key, "[{}] setting was deprecated in Elasticsearch and will be removed in a future release! " .critical(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

@ -1665,7 +1665,7 @@ 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(DeprecationCategory.PARSING, "camelCaseDateFormat", msg, formatName.getCamelCaseName(), .critical(DeprecationCategory.PARSING, "camelCaseDateFormat", msg, formatName.getCamelCaseName(),
formatName.getSnakeCaseName()); formatName.getSnakeCaseName());
} }
@ -1747,7 +1747,7 @@ 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(DeprecationCategory.PARSING, .critical(DeprecationCategory.PARSING,
"week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " + "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;

View file

@ -193,7 +193,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(DeprecationCategory.PARSING, "timezone", deprecationLogger.critical(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

@ -281,7 +281,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(DeprecationCategory.PARSING, "fractional_byte_values", .critical(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

@ -64,7 +64,7 @@ public class EsExecutors {
final int value = Setting.parseInt(s, 1, name); final int value = Setting.parseInt(s, 1, name);
final int availableProcessors = Runtime.getRuntime().availableProcessors(); final int availableProcessors = Runtime.getRuntime().availableProcessors();
if (value > availableProcessors) { if (value > availableProcessors) {
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, 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",

View file

@ -41,21 +41,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(DeprecationCategory.API, "deprecated_field_" + usedName, deprecationLogger.critical(DeprecationCategory.API, "deprecated_field_" + usedName,
"{}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(DeprecationCategory.API, "deprecated_field_" + usedName, deprecationLogger.critical(DeprecationCategory.API, "deprecated_field_" + usedName,
"{}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(DeprecationCategory.API, "deprecated_field_" + usedName, deprecationLogger.critical(DeprecationCategory.API, "deprecated_field_" + usedName,
"{}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

@ -62,7 +62,7 @@ public class HttpInfo implements ReportingService.Info {
String publishAddressString = publishAddress.toString(); String publishAddressString = publishAddress.toString();
String hostString = publishAddress.address().getHostString(); String hostString = publishAddress.address().getHostString();
if (CNAME_IN_PUBLISH_HOST) { if (CNAME_IN_PUBLISH_HOST) {
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, 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 " +

View file

@ -199,7 +199,7 @@ public final class IndexSortConfig {
if (this.indexCreatedVersion.onOrAfter(Version.V_7_13_0)) { if (this.indexCreatedVersion.onOrAfter(Version.V_7_13_0)) {
throw new IllegalArgumentException("Cannot use alias [" + sortSpec.field + "] as an index sort field"); throw new IllegalArgumentException("Cannot use alias [" + sortSpec.field + "] as an index sort field");
} else { } else {
DEPRECATION_LOGGER.deprecate( DEPRECATION_LOGGER.critical(
DeprecationCategory.MAPPINGS, DeprecationCategory.MAPPINGS,
"index-sort-aliases", "index-sort-aliases",
"Index sort for index [" + indexName + "] defined on field [" + sortSpec.field + "Index sort for index [" + indexName + "] defined on field [" + sortSpec.field +

View file

@ -73,7 +73,7 @@ public class Analysis {
public static void checkForDeprecatedVersion(String name, Settings settings) { public static void checkForDeprecatedVersion(String name, Settings settings) {
String sVersion = settings.get("version"); String sVersion = settings.get("version");
if (sVersion != null) { if (sVersion != null) {
DEPRECATION_LOGGER.deprecate( DEPRECATION_LOGGER.critical(
DeprecationCategory.ANALYSIS, DeprecationCategory.ANALYSIS,
"analyzer.version", "analyzer.version",
"Setting [version] on analysis component [" + name + "] has no effect and is deprecated" "Setting [version] on analysis component [" + name + "] has no effect and is deprecated"

View file

@ -120,7 +120,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(DeprecationCategory.ANALYSIS, name(), "Token filter [" + name() DEPRECATION_LOGGER.critical(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;
} }
@ -147,7 +147,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(DeprecationCategory.ANALYSIS, name(), "Token filter [" + name() DEPRECATION_LOGGER.critical(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

@ -39,7 +39,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(DeprecationCategory.ANALYSIS, "excessive_shingle_diff", deprecationLogger.critical(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 + "]");
} }
@ -65,7 +65,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
"] cannot be used to parse synonyms"); "] cannot be used to parse synonyms");
} }
else { else {
DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter " + name() DEPRECATION_LOGGER.critical(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

@ -186,7 +186,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(DeprecationCategory.MAPPINGS, "excessive_completion_contexts", deprecationLogger.critical(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

@ -299,7 +299,7 @@ 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(DeprecationCategory.MAPPINGS, "date_mapper_null_field", DEPRECATION_LOGGER.critical(DeprecationCategory.MAPPINGS, "date_mapper_null_field",
"Error parsing [" + nullValue.getValue() + "] as date in [null_value] on field [" + name() + "]);" "Error parsing [" + nullValue.getValue() + "] as date in [null_value] on field [" + name() + "]);"
+ " [null_value] will be ignored"); + " [null_value] will be ignored");
return null; return null;

View file

@ -211,7 +211,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(DeprecationCategory.MAPPINGS, "invalid_mapping_type", deprecationLogger.critical(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

@ -1195,7 +1195,7 @@ 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(DeprecationCategory.MAPPINGS, propName, deprecationLogger.critical(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] on mapper [{}] is deprecated, use [{}]", "Parameter [{}] on mapper [{}] is deprecated, use [{}]",
propName, name, parameter.name); propName, name, parameter.name);
} else { } else {
@ -1203,7 +1203,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
} }
if (parameter == null) { if (parameter == null) {
if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) { if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) {
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName, deprecationLogger.critical(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;
@ -1211,7 +1211,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(DeprecationCategory.TEMPLATES, propName, deprecationLogger.critical(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,
@ -1225,14 +1225,14 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
); );
} }
if (Objects.equals("boost", propName)) { if (Objects.equals("boost", propName)) {
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.MAPPINGS, 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(DeprecationCategory.MAPPINGS, propName, deprecationLogger.critical(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

@ -87,7 +87,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
@Override @Override
public FieldNamesFieldMapper build() { public FieldNamesFieldMapper build() {
if (enabled.getValue().explicit()) { if (enabled.getValue().explicit()) {
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE); deprecationLogger.critical(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);
@ -132,7 +132,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(DeprecationCategory.MAPPINGS, "terms_query_on_field_names", deprecationLogger.critical(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

@ -90,7 +90,7 @@ public class GeoShapeFieldMapper extends AbstractShapeGeometryFieldMapper<Geomet
@Override @Override
public GeoShapeFieldMapper build(MapperBuilderContext context) { public GeoShapeFieldMapper build(MapperBuilderContext context) {
if (multiFieldsBuilder.hasMultiFields()) { if (multiFieldsBuilder.hasMultiFields()) {
DEPRECATION_LOGGER.deprecate( DEPRECATION_LOGGER.critical(
DeprecationCategory.MAPPINGS, DeprecationCategory.MAPPINGS,
"geo_shape_multifields", "geo_shape_multifields",
"Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future" "Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future"

View file

@ -154,7 +154,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
IndexFieldDataCache cache, IndexFieldDataCache cache,
CircuitBreakerService breakerService CircuitBreakerService breakerService
) { ) {
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -123,7 +123,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(DeprecationCategory.MAPPINGS, "ip_mapper_null_field", "Error parsing [" + nullValue.getValue() DEPRECATION_LOGGER.critical(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

@ -469,7 +469,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(DeprecationCategory.MAPPINGS, "default_mapping_not_allowed", DEFAULT_MAPPING_ERROR_MESSAGE); deprecationLogger.critical(DeprecationCategory.MAPPINGS, "default_mapping_not_allowed", DEFAULT_MAPPING_ERROR_MESSAGE);
} }
assert defaultMapping.type().equals(DEFAULT_MAPPING); assert defaultMapping.type().equals(DEFAULT_MAPPING);
} }

View file

@ -153,7 +153,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(DeprecationCategory.API, "include_in_all", deprecationLogger.critical(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

@ -439,7 +439,7 @@ public class RootObjectMapper extends ObjectMapper {
"attempted to validate it with the following match_mapping_type: %s, caused by [%s]"; "attempted to validate it with the following match_mapping_type: %s, caused by [%s]";
String message = String.format(Locale.ROOT, format, String message = String.format(Locale.ROOT, format,
template.getName(), Strings.toString(template), Arrays.toString(types), lastError.getMessage()); template.getName(), Strings.toString(template), Arrays.toString(types), lastError.getMessage());
DEPRECATION_LOGGER.deprecate(DeprecationCategory.TEMPLATES, "invalid_dynamic_template", message); DEPRECATION_LOGGER.critical(DeprecationCategory.TEMPLATES, "invalid_dynamic_template", message);
} }
} }

View file

@ -38,7 +38,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(DeprecationCategory.TYPES, "query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
public static final String NAME = "_type"; public static final String NAME = "_type";

View file

@ -55,13 +55,13 @@ public final class TypeFieldType extends ConstantFieldType {
@Override @Override
public Query existsQuery(SearchExecutionContext context) { public Query existsQuery(SearchExecutionContext context) {
deprecationLogger.deprecate(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.critical(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(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.KEYWORD); return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.KEYWORD);
} }
@ -72,7 +72,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(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
if (caseInsensitive) { if (caseInsensitive) {
return pattern.equalsIgnoreCase(type); return pattern.equalsIgnoreCase(type);
} }

View file

@ -88,7 +88,7 @@ public class TypeParsers {
MappingParserContext parserContext, String propName, Object propNode) { MappingParserContext parserContext, String propName, Object propNode) {
if (propName.equals("fields")) { if (propName.equals("fields")) {
if (parserContext.isWithinMultiField()) { if (parserContext.isWithinMultiField()) {
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "multifield_within_multifield", deprecationLogger.critical(DeprecationCategory.MAPPINGS, "multifield_within_multifield",
"At least one multi-field, [" + name + "], was " + "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 " +

View file

@ -232,7 +232,7 @@ public class GeoShapeQueryBuilder extends AbstractGeometryQueryBuilder<GeoShapeQ
GeoShapeQueryBuilder builder; GeoShapeQueryBuilder builder;
if (pgsqp.type != null) { if (pgsqp.type != null) {
deprecationLogger.deprecate(DeprecationCategory.TYPES, "geo_share_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "geo_share_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
if (pgsqp.shape != null) { if (pgsqp.shape != null) {

View file

@ -141,7 +141,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(DeprecationCategory.TYPES, "ids_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "ids_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
return builder; return builder;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View file

@ -958,7 +958,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
} }
if (moreLikeThisQueryBuilder.isTypeless() == false) { if (moreLikeThisQueryBuilder.isTypeless() == false) {
deprecationLogger.deprecate(DeprecationCategory.API, "more_like_this_query_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.API, "more_like_this_query_with_types", TYPES_DEPRECATION_MESSAGE);
} }
return moreLikeThisQueryBuilder; return moreLikeThisQueryBuilder;
} }

View file

@ -412,7 +412,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(DeprecationCategory.MAPPINGS, "unmapped_type_string", deprecationLogger.critical(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

@ -118,7 +118,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(DeprecationCategory.TYPES, "type_query", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -152,7 +152,7 @@ public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder<RandomScore
} else { } else {
String fieldName; String fieldName;
if (field == null) { if (field == null) {
deprecationLogger.deprecate(DeprecationCategory.QUERIES, "seed_requires_field", deprecationLogger.critical(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

@ -363,7 +363,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(DeprecationCategory.TYPES, "reindex_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "reindex_with_types", TYPES_DEPRECATION_MESSAGE);
request.getSearchRequest().types(types); request.getSearchRequest().types(types);
} }
request.setRemoteInfo(buildRemoteInfo(source)); request.setRemoteInfo(buildRemoteInfo(source));
@ -379,7 +379,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(DeprecationCategory.TYPES, "reindex_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -132,7 +132,7 @@ 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(DeprecationCategory.QUERIES, basicModel + "_similarity_model_replaced", deprecationLogger.critical(DeprecationCategory.QUERIES, basicModel + "_similarity_model_replaced",
"Basic model [" + basicModel + "] isn't supported anymore and has arbitrarily been replaced with [" "Basic model [" + basicModel + "] isn't supported anymore and has arbitrarily been replaced with ["
+ replacement + "]."); + replacement + "].");
model = BASIC_MODELS.get(replacement); model = BASIC_MODELS.get(replacement);
@ -164,7 +164,7 @@ 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(DeprecationCategory.QUERIES, afterEffect + "_after_effect_replaced", deprecationLogger.critical(DeprecationCategory.QUERIES, afterEffect + "_after_effect_replaced",
"After effect [" + afterEffect + "] isn't supported anymore and has arbitrarily been replaced with [" "After effect [" + afterEffect + "] isn't supported anymore and has arbitrarily been replaced with ["
+ replacement + "]."); + replacement + "].");
effect = AFTER_EFFECTS.get(replacement); effect = AFTER_EFFECTS.get(replacement);
@ -255,7 +255,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(DeprecationCategory.QUERIES, "unknown_similarity_setting", deprecationLogger.critical(DeprecationCategory.QUERIES, "unknown_similarity_setting",
"Unknown settings for similarity of type [" + type + "]: " + unknownSettings); "Unknown settings for similarity of type [" + type + "]: " + unknownSettings);
} }
} }

View file

@ -55,7 +55,7 @@ public final class SimilarityService {
} else { } else {
final ClassicSimilarity similarity = SimilarityProviders.createClassicSimilarity(Settings.EMPTY, version); final ClassicSimilarity similarity = SimilarityProviders.createClassicSimilarity(Settings.EMPTY, version);
return () -> { return () -> {
deprecationLogger.deprecate(DeprecationCategory.QUERIES, "classic_similarity", deprecationLogger.critical(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.");
@ -79,7 +79,7 @@ public final class SimilarityService {
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(DeprecationCategory.QUERIES, "classic_similarity", deprecationLogger.critical(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.");
@ -143,7 +143,7 @@ public final class SimilarityService {
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(DeprecationCategory.QUERIES, "base_similarity_ignored", deprecationLogger.critical(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");
} }
} }
@ -264,7 +264,7 @@ public final class SimilarityService {
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(DeprecationCategory.QUERIES, "similarity_failure", message); deprecationLogger.critical(DeprecationCategory.QUERIES, "similarity_failure", message);
} }
} }

View file

@ -114,7 +114,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(DeprecationCategory.ANALYSIS, "standard_deprecation", deprecationLogger.critical(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.");
@ -175,7 +175,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(DeprecationCategory.ANALYSIS, "standard_deprecation", deprecationLogger.critical(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

@ -150,7 +150,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(DeprecationCategory.API, "synced_flush", SYNCED_FLUSH_DEPRECATION_MESSAGE); DEPRECATION_LOGGER.critical(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

@ -38,7 +38,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.core.Map.of( private static final Map<String, Function<Object, Object>> FUNCTIONS = org.elasticsearch.core.Map.of(
"_type", value -> { "_type", value -> {
deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "conditional-processor__type", deprecationLogger.critical(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

@ -324,7 +324,7 @@ public class Node implements Closeable {
logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk()); logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk());
} else { } else {
logger.info("JVM home [{}]", System.getProperty("java.home")); logger.info("JVM home [{}]", System.getProperty("java.home"));
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.OTHER, 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");
@ -338,7 +338,7 @@ public class Node implements Closeable {
if (Environment.PATH_SHARED_DATA_SETTING.exists(tmpSettings)) { if (Environment.PATH_SHARED_DATA_SETTING.exists(tmpSettings)) {
// NOTE: this must be done with an explicit check here because the deprecation property on a path setting will // NOTE: this must be done with an explicit check here because the deprecation property on a path setting will
// cause ES to fail to start since logging is not yet initialized on first read of the setting // cause ES to fail to start since logging is not yet initialized on first read of the setting
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, DeprecationCategory.SETTINGS,
"shared-data-path", "shared-data-path",
"setting [path.shared_data] is deprecated and will be removed in a future release" "setting [path.shared_data] is deprecated and will be removed in a future release"
@ -347,13 +347,13 @@ public class Node implements Closeable {
if (initialEnvironment.dataFiles().length > 1) { if (initialEnvironment.dataFiles().length > 1) {
// NOTE: we use initialEnvironment here, but assertEquivalent below ensures the data paths do not change // NOTE: we use initialEnvironment here, but assertEquivalent below ensures the data paths do not change
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "multiple-data-paths", deprecationLogger.critical(DeprecationCategory.SETTINGS, "multiple-data-paths",
"Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " + "Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
"multiple disks. This feature will be removed in 8.0."); "multiple disks. This feature will be removed in 8.0.");
} }
if (Environment.dataPathUsesList(tmpSettings)) { if (Environment.dataPathUsesList(tmpSettings)) {
// already checked for multiple values above, so if this is a list it is a single valued list // already checked for multiple values above, so if this is a list it is a single valued list
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "multiple-data-paths-list", deprecationLogger.critical(DeprecationCategory.SETTINGS, "multiple-data-paths-list",
"Configuring [path.data] with a list is deprecated. Instead specify as a string value."); "Configuring [path.data] with a list is deprecated. Instead specify as a string value.");
} }
@ -402,7 +402,7 @@ public class Node implements Closeable {
if (maybeLegacyRoleSettings.isEmpty() == false) { if (maybeLegacyRoleSettings.isEmpty() == false) {
final String legacyRoleSettingNames = final String legacyRoleSettingNames =
maybeLegacyRoleSettings.stream().map(Setting::getKey).collect(Collectors.joining(", ")); maybeLegacyRoleSettings.stream().map(Setting::getKey).collect(Collectors.joining(", "));
deprecationLogger.deprecate( deprecationLogger.critical(
DeprecationCategory.SETTINGS, DeprecationCategory.SETTINGS,
"legacy role settings", "legacy role settings",
"legacy role settings [{}] are deprecated, use [node.roles={}]", "legacy role settings [{}] are deprecated, use [node.roles={}]",

View file

@ -53,7 +53,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(DeprecationCategory.API, deprecationKey, deprecationMessage); deprecationLogger.critical(DeprecationCategory.API, deprecationKey, deprecationMessage);
handler.handleRequest(request, channel, client); handler.handleRequest(request, channel, client);
} }

View file

@ -54,7 +54,7 @@ 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(DeprecationCategory.API, "close-index-wait_for_active_shards-default", deprecationLogger.critical(DeprecationCategory.API, "close-index-wait_for_active_shards-default",
WAIT_FOR_ACTIVE_SHARDS_DEFAULT_DEPRECATION_MESSAGE); 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);

View file

@ -50,7 +50,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(DeprecationCategory.TYPES, "create_index_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -49,7 +49,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(DeprecationCategory.API, "force_merge_expunge_deletes_and_max_num_segments_deprecation", deprecationLogger.critical(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

@ -70,7 +70,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(DeprecationCategory.TYPES, "get_field_mapping_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(DeprecationCategory.TYPES, "get_field_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
} }
GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest(); GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest();
@ -78,7 +78,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(DeprecationCategory.API, "get_field_mapping_local", deprecationLogger.critical(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

@ -63,7 +63,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(DeprecationCategory.TYPES, "get_index_template_include_type_name", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(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

@ -62,7 +62,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(DeprecationCategory.TYPES, "get_indices_with_types", TYPES_DEPRECATION_MESSAGE); deprecationLogger.critical(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);

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