Introduce deprecation categories (#68061)

Sort-of backport of #67443.

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -35,6 +35,7 @@ import org.elasticsearch.cli.UserException;
import org.elasticsearch.common.PidFile;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.inject.CreationException;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.common.logging.Loggers;
@ -366,7 +367,7 @@ final class Bootstrap {
+ "requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. "
+ "If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.",
System.getProperty("java.home"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("java_version_11_required", message);
DeprecationLogger.getLogger(Bootstrap.class).deprecate(DeprecationCategory.OTHER, "java_version_11_required", message);
}
if (BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection") != null) {
final String message = String.format(
@ -374,7 +375,8 @@ final class Bootstrap {
"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.",
BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection"));
DeprecationLogger.getLogger(Bootstrap.class).deprecate("strict_duplicate_detection_setting_removed", message);
DeprecationLogger.getLogger(Bootstrap.class).deprecate(DeprecationCategory.SETTINGS,
"strict_duplicate_detection_setting_removed", message);
}
if (environment.pidFile() != null) {
try {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,45 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.common.logging;
/**
* Deprecation log messages are categorised so that consumers of the logs can easily aggregate them.
* <p>
* When categorising a message, you should consider the impact of the work required to mitigate the
* deprecation. For example, a settings change would normally be categorised as {@link #SETTINGS},
* but if the setting in question was related to security configuration, it may be more appropriate
* to categorise the deprecation message as {@link #SECURITY}.
*/
public enum DeprecationCategory {
AGGREGATIONS,
ANALYSIS,
API,
INDICES,
MAPPINGS,
OTHER,
PARSING,
PLUGINS,
QUERIES,
SCRIPTING,
SECURITY,
SETTINGS,
TEMPLATES,
TYPES
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,6 +23,7 @@ import org.apache.lucene.document.Field;
import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.TriFunction;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
@ -969,14 +970,15 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
}
Parameter<?> parameter = deprecatedParamsMap.get(propName);
if (parameter != null) {
deprecationLogger.deprecate(propName, "Parameter [{}] on mapper [{}] is deprecated, use [{}]",
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] on mapper [{}] is deprecated, use [{}]",
propName, name, parameter.name);
} else {
parameter = paramsMap.get(propName);
}
if (parameter == null) {
if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) {
deprecationLogger.deprecate(propName,
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] has no effect on type [{}] and will be removed in future", propName, type);
iterator.remove();
continue;
@ -984,7 +986,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
if (parserContext.isFromDynamicTemplate()) {
// 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
deprecationLogger.deprecate(propName,
deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, propName,
"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.",
propName,
@ -999,12 +1001,13 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
}
if (Objects.equals("boost", propName)) {
deprecationLogger.deprecate(
DeprecationCategory.MAPPINGS,
"boost",
"Parameter [boost] on field [{}] is deprecated and will be removed in 8.0",
name);
}
if (parameter.deprecated) {
deprecationLogger.deprecate(propName,
deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, propName,
"Parameter [{}] is deprecated and will be removed in a future version",
propName);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,6 +24,7 @@ import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -72,7 +73,7 @@ public class RestGetIndicesAction extends BaseRestHandler {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
// 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)) {
deprecationLogger.deprecate("get_indices_with_types", TYPES_DEPRECATION_MESSAGE);
deprecationLogger.deprecate(DeprecationCategory.TYPES, "get_indices_with_types", TYPES_DEPRECATION_MESSAGE);
}
final GetIndexRequest getIndexRequest = new GetIndexRequest();
getIndexRequest.indices(indices);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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