From 0d3cebe812080ea153d124b313fb2c184c7df75b Mon Sep 17 00:00:00 2001 From: Przemyslaw Gomulka Date: Thu, 9 Sep 2021 12:23:52 +0200 Subject: [PATCH] Change default deprecation logger level to CRITICAL (#77030) This commit changes default deprecation logger level to CRITICAL, where default means deprecations emitted by DeprecationLogger#critical method. It also introduces WARN deprecations which are emitted by DeprecationLogger#warn Those log lines emitted at WARN are meant to indicate that a functionality is deprecated but will not break at next major version. relates #76754 --- distribution/src/config/log4j2.properties | 2 +- docs/reference/setup/logging-config.asciidoc | 6 +- .../ConstructingObjectParserTests.java | 2 +- .../analysis/common/CommonAnalysisPlugin.java | 12 +- .../common/SynonymTokenFilterFactory.java | 2 +- .../ingest/useragent/UserAgentProcessor.java | 2 +- .../percolator/PercolateQueryBuilder.java | 2 +- .../index/reindex/ReindexValidator.java | 2 +- .../azure/classic/AzureDiscoveryPlugin.java | 2 +- .../discovery/ec2/Ec2ClientSettings.java | 4 +- .../common/logging/EvilLoggerTests.java | 13 +- .../common/logging/JsonLoggerTests.java | 61 ++++--- .../logging/json_layout/log4j2.properties | 2 +- .../snapshots/SystemIndicesSnapshotIT.java | 2 +- .../alias/get/TransportGetAliasesAction.java | 4 +- .../action/bulk/BulkRequestParser.java | 2 +- .../action/get/MultiGetRequest.java | 2 +- .../action/get/MultiGetResponse.java | 2 +- .../ingest/SimulatePipelineRequest.java | 2 +- .../action/search/MultiSearchRequest.java | 4 +- .../termvectors/TermVectorsRequest.java | 2 +- .../metadata/IndexNameExpressionResolver.java | 2 +- .../metadata/MetadataCreateIndexService.java | 8 +- .../org/elasticsearch/common/joda/Joda.java | 10 +- .../common/logging/DeprecationLogger.java | 49 ++++-- .../common/settings/Setting.java | 2 +- .../elasticsearch/common/time/DateUtils.java | 2 +- .../common/unit/ByteSizeValue.java | 2 +- .../xcontent/LoggingDeprecationHandler.java | 4 +- .../elasticsearch/index/IndexSortConfig.java | 2 +- .../index/analysis/Analysis.java | 2 +- .../analysis/ShingleTokenFilterFactory.java | 4 +- .../elasticsearch/index/get/GetResult.java | 2 +- .../index/mapper/CompletionFieldMapper.java | 2 +- .../index/mapper/DateFieldMapper.java | 2 +- .../index/mapper/FieldMapper.java | 10 +- .../index/mapper/FieldNamesFieldMapper.java | 4 +- .../index/mapper/GeoShapeFieldMapper.java | 2 +- .../index/mapper/IdFieldMapper.java | 2 +- .../index/mapper/IpFieldMapper.java | 2 +- .../index/mapper/ObjectMapper.java | 2 +- .../index/mapper/RootObjectMapper.java | 2 +- .../index/mapper/TypeParsers.java | 2 +- .../query/AbstractGeometryQueryBuilder.java | 2 +- .../index/query/CommonTermsQueryBuilder.java | 2 +- .../index/query/MoreLikeThisQueryBuilder.java | 2 +- .../index/query/TypeQueryV7Builder.java | 2 +- .../RandomScoreFunctionBuilder.java | 2 +- .../index/similarity/SimilarityProviders.java | 6 +- .../index/similarity/SimilarityService.java | 2 +- .../indices/analysis/AnalysisModule.java | 4 +- .../ingest/ConditionalProcessor.java | 2 +- .../java/org/elasticsearch/node/Node.java | 4 +- .../rest/DeprecationRestHandler.java | 4 +- .../admin/cluster/RestNodesStatsAction.java | 2 +- .../admin/indices/RestCloseIndexAction.java | 2 +- .../admin/indices/RestCreateIndexAction.java | 2 +- .../indices/RestGetFieldMappingAction.java | 4 +- .../indices/RestGetIndexTemplateAction.java | 2 +- .../admin/indices/RestGetIndicesAction.java | 2 +- .../admin/indices/RestGetMappingAction.java | 4 +- .../admin/indices/RestIndicesStatsAction.java | 2 +- .../indices/RestPutIndexTemplateAction.java | 6 +- .../admin/indices/RestPutMappingAction.java | 2 +- .../admin/indices/RestResizeHandler.java | 2 +- .../indices/RestRolloverIndexAction.java | 2 +- .../indices/RestValidateQueryAction.java | 2 +- .../action/document/RestGetSourceAction.java | 2 +- .../document/RestMultiTermVectorsAction.java | 2 +- .../rest/action/search/RestCountAction.java | 2 +- .../rest/action/search/RestSearchAction.java | 4 +- .../script/AbstractSortScript.java | 4 +- .../script/AggregationScript.java | 4 +- .../org/elasticsearch/script/FieldScript.java | 4 +- .../script/JodaCompatibleZonedDateTime.java | 2 +- .../org/elasticsearch/script/ScoreScript.java | 4 +- .../elasticsearch/script/ScriptMetadata.java | 4 +- .../script/ScriptedMetricAggContexts.java | 6 +- .../script/StoredScriptSource.java | 10 +- .../script/TermsSetQueryScript.java | 4 +- .../search/aggregations/InternalOrder.java | 2 +- .../AutoDateHistogramAggregatorFactory.java | 2 +- .../DateHistogramAggregatorFactory.java | 2 +- .../bucket/histogram/DateIntervalWrapper.java | 2 +- .../range/DateRangeAggregationBuilder.java | 2 +- .../SignificantTermsAggregatorFactory.java | 2 +- .../search/builder/SearchSourceBuilder.java | 4 +- .../search/fetch/subphase/FieldAndFormat.java | 2 +- .../search/sort/GeoDistanceSortBuilder.java | 4 +- .../completion/context/GeoContextMapping.java | 4 +- .../snapshots/RestoreService.java | 2 +- .../transport/TransportInfo.java | 2 +- .../indices/TransportAnalyzeActionTests.java | 4 +- .../index/analysis/AnalysisRegistryTests.java | 6 +- .../rest/DeprecationRestHandlerTests.java | 4 +- .../test/loggerusage/ESLoggerUsageTests.java | 2 +- .../query/DeprecatedQueryBuilder.java | 2 +- .../license/RestGetLicenseAction.java | 2 +- .../elasticsearch/xpack/core/XPackPlugin.java | 2 +- .../core/rest/action/RestXPackInfoAction.java | 2 +- .../authz/permission/IndicesPermission.java | 2 +- .../transform/action/GetTransformAction.java | 2 +- .../transforms/pivot/PivotConfig.java | 2 +- .../MockDeprecatedAggregationBuilder.java | 2 +- .../transform/MockDeprecatedQueryBuilder.java | 2 +- .../xpack/deprecation/DeprecationHttpIT.java | 150 ++++++++++++++---- .../TestDeprecatedQueryBuilder.java | 2 +- .../TestDeprecationHeaderRestAction.java | 16 +- .../graph/rest/action/RestGraphAction.java | 2 +- .../inference/RestGetTrainedModelsAction.java | 2 +- .../xpack/ml/utils/DomainSplitFunction.java | 2 +- .../action/TransportPutRollupJobAction.java | 2 +- .../xpack/security/authc/ApiKeyService.java | 6 +- .../xpack/security/authc/Realms.java | 2 +- .../authc/esnative/ReservedRealm.java | 2 +- .../ldap/ActiveDirectorySessionFactory.java | 2 +- .../authc/ldap/support/SessionFactory.java | 2 +- .../authz/store/CompositeRolesStore.java | 2 +- .../DeprecationRoleDescriptorConsumer.java | 2 +- ...eprecationRoleDescriptorConsumerTests.java | 2 +- .../GeoShapeWithDocValuesFieldMapper.java | 2 +- .../index/mapper/PointFieldMapper.java | 2 +- .../index/mapper/ShapeFieldMapper.java | 2 +- .../mapper/SparseVectorFieldMapper.java | 2 +- .../rest/action/RestWatcherStatsAction.java | 2 +- 125 files changed, 392 insertions(+), 247 deletions(-) diff --git a/distribution/src/config/log4j2.properties b/distribution/src/config/log4j2.properties index ac5287e8d54c..b7a97bd971b6 100644 --- a/distribution/src/config/log4j2.properties +++ b/distribution/src/config/log4j2.properties @@ -78,7 +78,7 @@ appender.header_warning.name = header_warning ################################################# logger.deprecation.name = org.elasticsearch.deprecation -logger.deprecation.level = deprecation +logger.deprecation.level = WARN logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling logger.deprecation.appenderRef.header_warning.ref = header_warning logger.deprecation.additivity = false diff --git a/docs/reference/setup/logging-config.asciidoc b/docs/reference/setup/logging-config.asciidoc index 7d25fec157f8..ae58c669a1df 100644 --- a/docs/reference/setup/logging-config.asciidoc +++ b/docs/reference/setup/logging-config.asciidoc @@ -200,12 +200,12 @@ By default, {es} rolls and compresses deprecation logs at 1GB. The default configuration preserves a maximum of five log files: four rolled logs and an active log. -{es} emits deprecation log messages at the `DEPRECATION` level. To stop writing -deprecation log messages, set `logger.deprecation.level` to `error`: +{es} emits deprecation log messages at the `CRITICAL` level. To stop writing +deprecation log messages, set `logger.deprecation.level` to `OFF`: [source,properties] ---- -logger.deprecation.level = error +logger.deprecation.level = OFF ---- You can identify what is triggering deprecated functionality if `X-Opaque-Id` was used as an HTTP header. diff --git a/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/ConstructingObjectParserTests.java b/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/ConstructingObjectParserTests.java index 5489f014924a..74b29cf8b8e9 100644 --- a/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/ConstructingObjectParserTests.java +++ b/libs/x-content/src/test/java/org/elasticsearch/common/xcontent/ConstructingObjectParserTests.java @@ -666,7 +666,7 @@ public class ConstructingObjectParserTests extends ESTestCase { } private static BiConsumer logWarningDoNothing(String old_name) { - return (struct,value) -> deprecationLogger.compatibleApiWarning("struct_removal", + return (struct,value) -> deprecationLogger.compatibleCritical("struct_removal", "The field old_name has been removed and is being ignored"); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java index 9e544ae0b1e5..7edee0d149a6 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonAnalysisPlugin.java @@ -243,7 +243,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(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "edgeNGram_deprecation", "The [edgeNGram] token filter name is deprecated and will be removed in a future version. " + "Please change the filter name to [edge_ngram] instead."); } @@ -280,7 +280,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri "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(DeprecationCategory.ANALYSIS, "nGram_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "nGram_deprecation", "The [nGram] token filter name is deprecated and will be removed in a future version. " + "Please change the filter name to [ngram] instead."); } @@ -336,7 +336,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri throw new IllegalArgumentException("The [nGram] tokenizer name was deprecated in 7.6. " + "Please use the tokenizer name to [ngram] for indices created in versions 8 or higher instead."); } else if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", "The [nGram] tokenizer name is deprecated and will be removed in a future version. " + "Please change the tokenizer name to [ngram] instead."); } @@ -348,7 +348,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri throw new IllegalArgumentException("The [edgeNGram] tokenizer name was deprecated in 7.6. " + "Please use the tokenizer name to [edge_nGram] for indices created in versions 8 or higher instead."); } else if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", "The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. " + "Please change the tokenizer name to [edge_ngram] instead."); } @@ -541,7 +541,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri throw new IllegalArgumentException("The [nGram] tokenizer name was deprecated in 7.6. " + "Please use the tokenizer name to [ngram] for indices created in versions 8 or higher instead."); } else if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "nGram_tokenizer_deprecation", "The [nGram] tokenizer name is deprecated and will be removed in a future version. " + "Please change the tokenizer name to [ngram] instead."); } @@ -552,7 +552,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri throw new IllegalArgumentException("The [edgeNGram] tokenizer name was deprecated in 7.6. " + "Please use the tokenizer name to [edge_ngram] for indices created in versions 8 or higher instead."); } else if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "edgeNGram_tokenizer_deprecation", "The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. " + "Please change the tokenizer name to [edge_ngram] instead."); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SynonymTokenFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SynonymTokenFilterFactory.java index b02834e37885..feeea15589dc 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SynonymTokenFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/SynonymTokenFilterFactory.java @@ -47,7 +47,7 @@ public class SynonymTokenFilterFactory extends AbstractTokenFilterFactory { this.settings = settings; if (settings.get("ignore_case") != null) { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_ignore_case_option", + DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_ignore_case_option", "The ignore_case option on the synonym_graph filter is deprecated. " + "Instead, insert a lowercase filter in the filter chain before the synonym_graph filter."); } diff --git a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentProcessor.java b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentProcessor.java index fd6023e841db..a973d3d3e14e 100644 --- a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentProcessor.java +++ b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentProcessor.java @@ -193,7 +193,7 @@ public class UserAgentProcessor extends AbstractProcessor { boolean ignoreMissing = readBooleanProperty(TYPE, processorTag, config, "ignore_missing", false); Object ecsValue = config.remove("ecs"); if (ecsValue != null) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ingest_useragent_ecs_settings", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "ingest_useragent_ecs_settings", "setting [ecs] is deprecated as ECS format is the default and only option"); } diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java index 376949c91420..c4110b40cbbe 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java @@ -362,7 +362,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder deprecateAndIgnoreType(String key, String message) { - return (target, type) -> deprecationLogger.compatibleApiWarning(key, message); + return (target, type) -> deprecationLogger.compatibleCritical(key, message); } private static BytesReference parseDocument(XContentParser parser) throws IOException { diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexValidator.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexValidator.java index 4319e75fee76..39c2dfae4576 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexValidator.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexValidator.java @@ -56,7 +56,7 @@ public class ReindexValidator { state); SearchSourceBuilder searchSource = request.getSearchRequest().source(); if (searchSource != null && searchSource.sorts() != null && searchSource.sorts().isEmpty() == false) { - deprecationLogger.deprecate(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE); + deprecationLogger.critical(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE); } } diff --git a/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/plugin/discovery/azure/classic/AzureDiscoveryPlugin.java b/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/plugin/discovery/azure/classic/AzureDiscoveryPlugin.java index 328d89c1f69e..5fb40703288b 100644 --- a/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/plugin/discovery/azure/classic/AzureDiscoveryPlugin.java +++ b/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/plugin/discovery/azure/classic/AzureDiscoveryPlugin.java @@ -38,7 +38,7 @@ public class AzureDiscoveryPlugin extends Plugin implements DiscoveryPlugin { public AzureDiscoveryPlugin(Settings settings) { this.settings = settings; - deprecationLogger.deprecate(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated."); + deprecationLogger.critical(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated."); logger.trace("starting azure classic discovery plugin..."); } diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2ClientSettings.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2ClientSettings.java index 370d8d4651ba..83949291760c 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2ClientSettings.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2ClientSettings.java @@ -125,12 +125,12 @@ final class Ec2ClientSettings { return null; } else { if (key.length() == 0) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ec2_invalid_settings", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "ec2_invalid_settings", "Setting [{}] is set but [{}] is not, which will be unsupported in future", SECRET_KEY_SETTING.getKey(), ACCESS_KEY_SETTING.getKey()); } if (secret.length() == 0) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "ec2_invalid_settings", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "ec2_invalid_settings", "Setting [{}] is set but [{}] is not, which will be unsupported in future", ACCESS_KEY_SETTING.getKey(), SECRET_KEY_SETTING.getKey()); } diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java index 248f54269fac..485db9612aeb 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java @@ -21,10 +21,10 @@ import org.apache.lucene.util.Constants; import org.elasticsearch.cli.UserException; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.Randomness; -import org.elasticsearch.core.PathUtils; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.core.PathUtils; import org.elasticsearch.env.Environment; import org.elasticsearch.node.Node; import org.elasticsearch.test.ESTestCase; @@ -46,7 +46,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.IntStream; -import static org.elasticsearch.common.logging.DeprecationLogger.DEPRECATION; import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; @@ -117,7 +116,7 @@ public class EvilLoggerTests extends ESTestCase { } for (int j = 0; j < iterations; j++) { for (final Integer id : ids) { - deprecationLogger.deprecate(DeprecationCategory.OTHER, Integer.toString(id), + deprecationLogger.critical(DeprecationCategory.OTHER, Integer.toString(id), "This is a maybe logged deprecation message" + id); } } @@ -171,8 +170,8 @@ public class EvilLoggerTests extends ESTestCase { for (int i = 0; i < 128; i++) { assertLogLine( deprecationEvents.get(i), - DEPRECATION, - "org.elasticsearch.common.logging.DeprecationLogger.deprecate", + DeprecationLogger.CRITICAL, + "org.elasticsearch.common.logging.DeprecationLogger.logDeprecation", "This is a maybe logged deprecation message" + i); } @@ -204,8 +203,8 @@ public class EvilLoggerTests extends ESTestCase { assertThat(deprecationEvents.size(), equalTo(1)); assertLogLine( deprecationEvents.get(0), - DEPRECATION, - "org.elasticsearch.common.logging.DeprecationLogger.deprecate", + DeprecationLogger.CRITICAL, + "org.elasticsearch.common.logging.DeprecationLogger.logDeprecation", "\\[deprecated.foo\\] setting was deprecated in Elasticsearch and will be removed in a future release! " + "See the breaking changes documentation for the next major version."); } diff --git a/qa/logging-config/src/test/java/org/elasticsearch/common/logging/JsonLoggerTests.java b/qa/logging-config/src/test/java/org/elasticsearch/common/logging/JsonLoggerTests.java index 3d8c5ff2301e..bd1740ed202e 100644 --- a/qa/logging-config/src/test/java/org/elasticsearch/common/logging/JsonLoggerTests.java +++ b/qa/logging-config/src/test/java/org/elasticsearch/common/logging/JsonLoggerTests.java @@ -78,10 +78,35 @@ public class JsonLoggerTests extends ESTestCase { super.tearDown(); } + public void testDeprecationWarnMessage() throws IOException { + final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); + + testLogger.warn(DeprecationCategory.OTHER, "a key", "deprecated warn message1"); + + final Path path = PathUtils.get(System.getProperty("es.logs.base_path"), + System.getProperty("es.logs.cluster_name") + "_deprecated.json"); + + try (Stream> stream = JsonLogsStream.mapStreamFrom(path)) { + List> jsonLogs = stream + .collect(Collectors.toList()); + + assertThat(jsonLogs, contains( + allOf( + hasEntry("log.level", "WARN"), + hasEntry("log.logger", "org.elasticsearch.deprecation.test"), + hasEntry("elasticsearch.event.category", "other"), + hasEntry("message", "deprecated warn message1") + )) + ); + } + + assertWarnings("deprecated warn message1"); + } + public void testDeprecatedMessageWithoutXOpaqueId() throws IOException { final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); - testLogger.deprecate(DeprecationCategory.OTHER, "a key", "deprecated message1"); + testLogger.critical(DeprecationCategory.OTHER, "a key", "deprecated message1"); final Path path = PathUtils.get(System.getProperty("es.logs.base_path"), System.getProperty("es.logs.cluster_name") + "_deprecated.json"); @@ -93,7 +118,7 @@ public class JsonLoggerTests extends ESTestCase { assertThat(jsonLogs, contains( allOf( hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("log.logger", "org.elasticsearch.deprecation.test"), hasEntry("elasticsearch.cluster.name", "elasticsearch"), hasEntry("elasticsearch.node.name", "sample-name"), @@ -117,8 +142,8 @@ public class JsonLoggerTests extends ESTestCase { threadContext.putHeader(Task.X_OPAQUE_ID, "someId"); threadContext.putHeader(Task.TRACE_ID, "someTraceId"); final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); - testLogger.deprecate(DeprecationCategory.OTHER,"someKey", "deprecated message1") - .compatibleApiWarning("compatibleKey","compatible API message"); + testLogger.critical(DeprecationCategory.OTHER,"someKey", "deprecated message1") + .compatibleCritical("compatibleKey","compatible API message"); final Path path = PathUtils.get( System.getProperty("es.logs.base_path"), @@ -132,7 +157,7 @@ public class JsonLoggerTests extends ESTestCase { jsonLogs, contains( allOf( - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("event.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.namespace", "default"), @@ -148,7 +173,7 @@ public class JsonLoggerTests extends ESTestCase { hasEntry("elasticsearch.event.category", "other") ), allOf( - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), // event.dataset and data_stream.dataset have to be the same across the data stream hasEntry("event.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.dataset", "deprecation.elasticsearch"), @@ -200,7 +225,7 @@ public class JsonLoggerTests extends ESTestCase { contains( // deprecation log for field deprecated_name allOf( - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("event.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.namespace", "default"), @@ -217,7 +242,7 @@ public class JsonLoggerTests extends ESTestCase { ), // deprecation log for field deprecated_name2 (note it is not being throttled) allOf( - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("event.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.namespace", "default"), @@ -234,7 +259,7 @@ public class JsonLoggerTests extends ESTestCase { ), // compatible log line allOf( - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("event.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.dataset", "deprecation.elasticsearch"), hasEntry("data_stream.namespace", "default"), @@ -264,7 +289,7 @@ public class JsonLoggerTests extends ESTestCase { threadContext.putHeader(Task.X_OPAQUE_ID, "someId"); threadContext.putHeader(Task.TRACE_ID, "someTraceId"); final DeprecationLogger testLogger = DeprecationLogger.getLogger("org.elasticsearch.test"); - testLogger.deprecate(DeprecationCategory.OTHER, "someKey", "deprecated message1"); + testLogger.critical(DeprecationCategory.OTHER, "someKey", "deprecated message1"); final Path path = PathUtils.get( System.getProperty("es.logs.base_path"), @@ -279,7 +304,7 @@ public class JsonLoggerTests extends ESTestCase { contains( allOf( hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("log.logger", "org.elasticsearch.deprecation.test"), hasEntry("elasticsearch.cluster.name", "elasticsearch"), hasEntry("elasticsearch.node.name", "sample-name"), @@ -475,8 +500,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(DeprecationCategory.OTHER, "key", "message1"); - deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2"); + deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1"); + deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message2"); assertWarnings("message1", "message2"); final Path path = PathUtils.get(System.getProperty("es.logs.base_path"), @@ -488,7 +513,7 @@ public class JsonLoggerTests extends ESTestCase { assertThat(jsonLogs, contains( allOf( hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("log.logger", "org.elasticsearch.deprecation.test"), hasEntry("elasticsearch.cluster.name", "elasticsearch"), hasEntry("elasticsearch.node.name", "sample-name"), @@ -504,8 +529,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(DeprecationCategory.OTHER, "key", "message1"); - deprecationLogger.deprecate(DeprecationCategory.OTHER, "key", "message2"); + deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1"); + deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message2"); assertWarnings("message1", "message2"); final Path path = PathUtils.get( @@ -520,7 +545,7 @@ public class JsonLoggerTests extends ESTestCase { contains( allOf( hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("log.logger", "org.elasticsearch.deprecation.test"), hasEntry("elasticsearch.cluster.name", "elasticsearch"), hasEntry("elasticsearch.node.name", "sample-name"), @@ -530,7 +555,7 @@ public class JsonLoggerTests extends ESTestCase { ), allOf( hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasEntry("log.logger", "org.elasticsearch.deprecation.test"), hasEntry("elasticsearch.cluster.name", "elasticsearch"), hasEntry("elasticsearch.node.name", "sample-name"), diff --git a/qa/logging-config/src/test/resources/org/elasticsearch/common/logging/json_layout/log4j2.properties b/qa/logging-config/src/test/resources/org/elasticsearch/common/logging/json_layout/log4j2.properties index 67ecb59a3d60..46baac4f1433 100644 --- a/qa/logging-config/src/test/resources/org/elasticsearch/common/logging/json_layout/log4j2.properties +++ b/qa/logging-config/src/test/resources/org/elasticsearch/common/logging/json_layout/log4j2.properties @@ -40,7 +40,7 @@ appender.header_warning.type = HeaderWarningAppender appender.header_warning.name = header_warning logger.deprecation.name = org.elasticsearch.deprecation -logger.deprecation.level = deprecation +logger.deprecation.level = WARN logger.deprecation.appenderRef.deprecation_rolling.ref = deprecated logger.deprecation.appenderRef.deprecatedconsole.ref = deprecatedconsole logger.deprecation.appenderRef.header_warning.ref = header_warning diff --git a/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SystemIndicesSnapshotIT.java b/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SystemIndicesSnapshotIT.java index fa73d9ef54b3..b01cc4f463d6 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SystemIndicesSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/snapshots/SystemIndicesSnapshotIT.java @@ -364,7 +364,7 @@ public class SystemIndicesSnapshotIT extends AbstractSnapshotIntegTestCase { new MockLogAppender.SeenEventExpectation( "restore-system-index-from-snapshot", "org.elasticsearch.deprecation.snapshots.RestoreService", - DeprecationLogger.DEPRECATION, + DeprecationLogger.CRITICAL, "Restoring system indices by name is deprecated. Use feature states instead. System indices: [.test-system-idx]" ) ); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java index c5fe0cea2d9a..30fcc16c8ac0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java @@ -150,7 +150,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction i } else if (VERSION_TYPE.match(currentFieldName, parser.getDeprecationHandler())) { termVectorsRequest.versionType = VersionType.fromString(parser.text()); } else if (restApiVersion == RestApiVersion.V_7 && TYPE.match(currentFieldName, parser.getDeprecationHandler())) { - deprecationLogger.compatibleApiWarning("termvectors_with_types", + deprecationLogger.compatibleCritical("termvectors_with_types", RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); } else { throw new ElasticsearchParseException("failed to parse term vectors request. unknown field [{}]", currentFieldName); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java index cda2ce550608..a8ee8afc7ec4 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java @@ -352,7 +352,7 @@ public class IndexNameExpressionResolver { if (resolvedSystemIndices.isEmpty() == false) { Collections.sort(resolvedSystemIndices); - deprecationLogger.deprecate(DeprecationCategory.API, "open_system_index_access", + deprecationLogger.critical(DeprecationCategory.API, "open_system_index_access", "this request accesses system indices: {}, but in a future major version, direct access to system " + "indices will be prevented by default", resolvedSystemIndices); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java index 2c78fefe0e68..b3c7a5dc158b 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java @@ -204,7 +204,7 @@ public class MetadataCreateIndexService { } else if (isHidden) { logger.trace("index [{}] is a hidden index", index); } else { - deprecationLogger.deprecate(DeprecationCategory.INDICES, "index_name_starts_with_dot", + deprecationLogger.critical(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); } @@ -366,7 +366,7 @@ public class MetadataCreateIndexService { request.index(), isHiddenFromRequest); if (v1Templates.size() > 1) { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "index_template_multiple_match", + deprecationLogger.critical(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(", "))); } @@ -1274,7 +1274,7 @@ 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))) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.SETTINGS, "translog_retention", "Translog retention settings [index.translog.retention.age] and [index.translog.retention.size] are deprecated and " @@ -1286,7 +1286,7 @@ public class MetadataCreateIndexService { public static void validateStoreTypeSetting(Settings indexSettings) { final String storeType = IndexModule.INDEX_STORE_TYPE_SETTING.get(indexSettings); if (IndexModule.Type.SIMPLEFS.match(storeType)) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "store_type_setting", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "store_type_setting", "[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " + "Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type as it offers superior " + "or equivalent performance to [simplefs]."); diff --git a/server/src/main/java/org/elasticsearch/common/joda/Joda.java b/server/src/main/java/org/elasticsearch/common/joda/Joda.java index 7835ca8bec82..ebdfd7bc6aee 100644 --- a/server/src/main/java/org/elasticsearch/common/joda/Joda.java +++ b/server/src/main/java/org/elasticsearch/common/joda/Joda.java @@ -264,16 +264,16 @@ public class Joda { private static void maybeLogJodaDeprecation(String input) { if (input.contains("CC")) { - getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "joda-century-of-era-format", + getDeprecationLogger().critical(DeprecationCategory.PARSING, "joda-century-of-era-format", "Use of 'C' (century-of-era) is deprecated and will not be supported in the next major version of Elasticsearch."); } if (input.contains("YY")) { - getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "joda-year-of-era-format", + getDeprecationLogger().critical(DeprecationCategory.PARSING, "joda-year-of-era-format", "Use of 'Y' (year-of-era) will change to 'y' in the" + " next major version of Elasticsearch. Prefix your date format with '8' to use the new specifier."); } if (input.contains("xx")) { - getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "joda-week-based-year-format", + getDeprecationLogger().critical(DeprecationCategory.PARSING, "joda-week-based-year-format", "Use of 'x' (week-based-year) will change" + " to 'Y' in the next major version of Elasticsearch. Prefix your date format with '8' to use the new specifier."); } @@ -372,11 +372,11 @@ 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(DeprecationCategory.PARSING, "epoch-negative", "Use of negative values" + + getDeprecationLogger().critical(DeprecationCategory.PARSING, "epoch-negative", "Use of negative values" + " in epoch time formats is deprecated and will not be supported in the next major version of Elasticsearch."); } if (scientificNotation.matcher(text).find()) { - getDeprecationLogger().deprecate(DeprecationCategory.PARSING, "epoch-scientific-notation", + getDeprecationLogger().critical(DeprecationCategory.PARSING, "epoch-scientific-notation", "Use of scientific notation" + " in epoch time formats is deprecated and will not be supported in the next major version of Elasticsearch."); } diff --git a/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java b/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java index cd04c88d8ee2..31c6afb468ba 100644 --- a/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java +++ b/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java @@ -13,12 +13,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** - * A logger that logs deprecation notices. Logger should be initialized with a parent logger which name will be used + * A logger that logs deprecation notices. Logger should be initialized with a class or name which will be used * for deprecation logger. For instance DeprecationLogger.getLogger("org.elasticsearch.test.SomeClass") will * result in a deprecation logger with name org.elasticsearch.deprecation.test.SomeClass. This allows to use a * deprecation logger defined in log4j2.properties. *

- * Logs are emitted at the custom {@link #DEPRECATION} level, and routed wherever they need to go using log4j. For example, + * Logs are emitted at the custom {@link #CRITICAL} level, and routed wherever they need to go using log4j. For example, * to disk using a rolling file appender, or added as a response header using {@link HeaderWarningAppender}. *

* Deprecation messages include a key, which is used for rate-limiting purposes. The log4j configuration @@ -27,11 +27,12 @@ import org.apache.logging.log4j.Logger; * message limiting. */ public class DeprecationLogger { - /** * Deprecation messages are logged at this level. + * More serious that WARN by 1, but less serious than ERROR */ - public static Level DEPRECATION = Level.forName("DEPRECATION", Level.WARN.intLevel() + 1); + public static Level CRITICAL = Level.forName("CRITICAL", Level.WARN.intLevel() - 1); + private final Logger logger; @@ -72,29 +73,55 @@ public class DeprecationLogger { } /** - * Logs a message at the {@link #DEPRECATION} level. The message is also sent to the header warning logger, + * Logs a message at the {@link DeprecationLogger#CRITICAL} level. + * This log will indicate that a change will break in next version. + * The message is also sent to the header warning logger, * so that it can be returned to the client. */ - public DeprecationLogger deprecate( + public DeprecationLogger critical( final DeprecationCategory category, final String key, final String msg, - final Object... params - ) { + final Object... params) { + return logDeprecation(CRITICAL, category, key, msg, params); + } + + /** + * Logs a message at the {@link Level#WARN} level for less critical deprecations + * that won't break in next version. + * The message is also sent to the header warning logger, + * so that it can be returned to the client. + */ + public DeprecationLogger warn( + final DeprecationCategory category, + final String key, + final String msg, + final Object... params) { + return logDeprecation(Level.WARN, category, key, msg, params); + } + + private DeprecationLogger logDeprecation(Level level, DeprecationCategory category, String key, String msg, Object[] params) { assert category != DeprecationCategory.COMPATIBLE_API : "DeprecationCategory.COMPATIBLE_API should be logged with compatibleApiWarning method"; ESLogMessage deprecationMessage = DeprecatedMessage.of(category, key, HeaderWarning.getXOpaqueId(), msg, params); - logger.log(DEPRECATION, deprecationMessage); + logger.log(level, deprecationMessage); return this; } - public DeprecationLogger compatibleApiWarning( + /** + * Used for handling previous version RestApiCompatible logic. + * Logs a message at the {@link DeprecationLogger#CRITICAL} level + * that have been broken in previous version. + * The message is also sent to the header warning logger, + * so that it can be returned to the client. + */ + public DeprecationLogger compatibleCritical( final String key, final String msg, final Object... params) { String opaqueId = HeaderWarning.getXOpaqueId(); ESLogMessage deprecationMessage = DeprecatedMessage.compatibleDeprecationMessage(key, opaqueId, msg, params); - logger.log(DEPRECATION, deprecationMessage); + logger.log(CRITICAL, deprecationMessage); return this; } diff --git a/server/src/main/java/org/elasticsearch/common/settings/Setting.java b/server/src/main/java/org/elasticsearch/common/settings/Setting.java index 487bacf1dd82..309257fd0ecb 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/Setting.java +++ b/server/src/main/java/org/elasticsearch/common/settings/Setting.java @@ -548,7 +548,7 @@ public class Setting implements ToXContentObject { // It would be convenient to show its replacement key, but replacement is often not so simple final String key = getKey(); Settings.DeprecationLoggerHolder.deprecationLogger - .deprecate(DeprecationCategory.SETTINGS, key, + .critical(DeprecationCategory.SETTINGS, 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); } diff --git a/server/src/main/java/org/elasticsearch/common/time/DateUtils.java b/server/src/main/java/org/elasticsearch/common/time/DateUtils.java index 08bb0ef5a2da..70659c76cb45 100644 --- a/server/src/main/java/org/elasticsearch/common/time/DateUtils.java +++ b/server/src/main/java/org/elasticsearch/common/time/DateUtils.java @@ -190,7 +190,7 @@ public class DateUtils { public static ZoneId of(String zoneId) { String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId); if (deprecatedId != null) { - deprecationLogger.deprecate(DeprecationCategory.PARSING, "timezone", + deprecationLogger.critical(DeprecationCategory.PARSING, "timezone", "Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead"); return ZoneId.of(deprecatedId); } diff --git a/server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java b/server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java index d0debefac403..5f632859c5c0 100644 --- a/server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java +++ b/server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java @@ -261,7 +261,7 @@ public class ByteSizeValue implements Writeable, Comparable, ToXC try { final double doubleValue = Double.parseDouble(s); DeprecationLoggerHolder.deprecationLogger - .deprecate(DeprecationCategory.PARSING, "fractional_byte_values", + .critical(DeprecationCategory.PARSING, "fractional_byte_values", "Fractional bytes values are deprecated. Use non-fractional bytes values instead: [{}] found for setting [{}]", initialInput, settingName); return new ByteSizeValue((long) (doubleValue * unit.toBytes(1))); diff --git a/server/src/main/java/org/elasticsearch/common/xcontent/LoggingDeprecationHandler.java b/server/src/main/java/org/elasticsearch/common/xcontent/LoggingDeprecationHandler.java index 28e8886509ec..e494afa2e6b6 100644 --- a/server/src/main/java/org/elasticsearch/common/xcontent/LoggingDeprecationHandler.java +++ b/server/src/main/java/org/elasticsearch/common/xcontent/LoggingDeprecationHandler.java @@ -37,10 +37,10 @@ public class LoggingDeprecationHandler implements DeprecationHandler { public static final LoggingDeprecationHandler INSTANCE = new LoggingDeprecationHandler(); private TriConsumer deprecationLoggerFunction = (message, params, field_name) -> - deprecationLogger.deprecate(DeprecationCategory.API, "deprecated_field_" + field_name, message, params); + deprecationLogger.critical(DeprecationCategory.API, "deprecated_field_" + field_name, message, params); private TriConsumer compatibleLoggerFunction = (message, params, field_name) -> - deprecationLogger.compatibleApiWarning("deprecated_field_" + field_name, message, params); + deprecationLogger.compatibleCritical("deprecated_field_" + field_name, message, params); private LoggingDeprecationHandler() { // one instance only diff --git a/server/src/main/java/org/elasticsearch/index/IndexSortConfig.java b/server/src/main/java/org/elasticsearch/index/IndexSortConfig.java index 7f4765c1c534..a56095a1c188 100644 --- a/server/src/main/java/org/elasticsearch/index/IndexSortConfig.java +++ b/server/src/main/java/org/elasticsearch/index/IndexSortConfig.java @@ -190,7 +190,7 @@ public final class IndexSortConfig { if (this.indexCreatedVersion.onOrAfter(Version.V_7_13_0)) { throw new IllegalArgumentException("Cannot use alias [" + sortSpec.field + "] as an index sort field"); } else { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.MAPPINGS, "index-sort-aliases", "Index sort for index [" + indexName + "] defined on field [" + sortSpec.field + diff --git a/server/src/main/java/org/elasticsearch/index/analysis/Analysis.java b/server/src/main/java/org/elasticsearch/index/analysis/Analysis.java index a42e32f3a9a6..b271b132c0e6 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/Analysis.java +++ b/server/src/main/java/org/elasticsearch/index/analysis/Analysis.java @@ -72,7 +72,7 @@ public class Analysis { public static void checkForDeprecatedVersion(String name, Settings settings) { String sVersion = settings.get("version"); if (sVersion != null) { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.ANALYSIS, "analyzer.version", "Setting [version] on analysis component [" + name + "] has no effect and is deprecated" diff --git a/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java b/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java index 7bcb70475def..20f0d166687e 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java +++ b/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java @@ -39,7 +39,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 { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "excessive_shingle_diff", + DEPRECATION_LOGGER.critical(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 + "]"); } @@ -65,7 +65,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory { "] cannot be used to parse synonyms"); } else { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter " + name() + DEPRECATION_LOGGER.critical(DeprecationCategory.ANALYSIS, "synonym_tokenfilters", "Token filter " + name() + "] will not be usable to parse synonym after v7.0"); } return this; diff --git a/server/src/main/java/org/elasticsearch/index/get/GetResult.java b/server/src/main/java/org/elasticsearch/index/get/GetResult.java index c136e84d41e8..7c5a7d18857d 100644 --- a/server/src/main/java/org/elasticsearch/index/get/GetResult.java +++ b/server/src/main/java/org/elasticsearch/index/get/GetResult.java @@ -327,7 +327,7 @@ public class GetResult implements Writeable, Iterable, ToXContent if (_INDEX.equals(currentFieldName)) { index = parser.text(); } else if (parser.getRestApiVersion() == RestApiVersion.V_7 && MapperService.TYPE_FIELD_NAME.equals(currentFieldName)) { - deprecationLogger.compatibleApiWarning("mget_with_types", RestMultiGetAction.TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("mget_with_types", RestMultiGetAction.TYPES_DEPRECATION_MESSAGE); } else if (_ID.equals(currentFieldName)) { id = parser.text(); } else if (_VERSION.equals(currentFieldName)) { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java index b1566740fbe6..1bb75e9d4eb7 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java @@ -189,7 +189,7 @@ public class CompletionFieldMapper extends FieldMapper { throw new IllegalArgumentException( "Limit of completion field contexts [" + COMPLETION_CONTEXTS_LIMIT + "] has been exceeded"); } else { - deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "excessive_completion_contexts", + deprecationLogger.critical(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 " + diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java index 2bcec9923d91..bbf95d6df9e7 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java @@ -295,7 +295,7 @@ public final class DateFieldMapper extends FieldMapper { if (indexCreatedVersion.onOrAfter(Version.V_8_0_0)) { throw new MapperParsingException("Error parsing [null_value] on field [" + name() + "]: " + e.getMessage(), e); } else { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.MAPPINGS, "date_mapper_null_field", + DEPRECATION_LOGGER.critical(DeprecationCategory.MAPPINGS, "date_mapper_null_field", "Error parsing [" + nullValue.getValue() + "] as date in [null_value] on field [" + name() + "]); [null_value] will be ignored"); return null; diff --git a/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java index 836f30d365ab..13f5085b82c6 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java @@ -1130,7 +1130,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable { } if (Objects.equals("boost", propName)) { if (parserContext.indexVersionCreated().before(Version.V_8_0_0)) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.API, "boost", "Parameter [boost] on field [{}] is deprecated and has no effect", @@ -1143,14 +1143,14 @@ public abstract class FieldMapper extends Mapper implements Cloneable { } Parameter parameter = deprecatedParamsMap.get(propName); if (parameter != null) { - deprecationLogger.deprecate(DeprecationCategory.API, propName, "Parameter [{}] on mapper [{}] is deprecated, use [{}]", + deprecationLogger.critical(DeprecationCategory.API, 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(DeprecationCategory.API, propName, + deprecationLogger.critical(DeprecationCategory.API, propName, "Parameter [{}] has no effect on type [{}] and will be removed in future", propName, type); iterator.remove(); continue; @@ -1158,7 +1158,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable { if (parserContext.isFromDynamicTemplate() && parserContext.indexVersionCreated().before(Version.V_8_0_0)) { // 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(DeprecationCategory.API, propName, + deprecationLogger.critical(DeprecationCategory.API, 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, @@ -1172,7 +1172,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable { ); } if (parameter.deprecated) { - deprecationLogger.deprecate(DeprecationCategory.API, propName, + deprecationLogger.critical(DeprecationCategory.API, propName, "Parameter [{}] is deprecated and will be removed in a future version", propName); } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java index 4a41f16aa12b..ec1b0d61772e 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java @@ -89,7 +89,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper { throw new MapperParsingException("The `enabled` setting for the `_field_names` field has been deprecated and " + "removed. Please remove it from your mappings and templates."); } else { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE); } } @@ -143,7 +143,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(DeprecationCategory.MAPPINGS, "terms_query_on_field_names", + deprecationLogger.critical(DeprecationCategory.MAPPINGS, "terms_query_on_field_names", "terms query on the _field_names field is deprecated and will be removed, use exists query instead"); return super.termQuery(value, context); } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java index 343d1b5bef69..bf5686538e1d 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java @@ -91,7 +91,7 @@ public class GeoShapeFieldMapper extends AbstractShapeGeometryFieldMapper fieldData = fieldDataBuilder.build(cache, breakerService); return new IndexFieldData<>() { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java index f68d37cd3a08..63ae3a52fee5 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java @@ -120,7 +120,7 @@ public class IpFieldMapper extends FieldMapper { if (indexCreatedVersion.onOrAfter(Version.V_8_0_0)) { throw new MapperParsingException("Error parsing [null_value] on field [" + name() + "]: " + e.getMessage(), e); } else { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.MAPPINGS, "ip_mapper_null_field", "Error parsing [" + + DEPRECATION_LOGGER.critical(DeprecationCategory.MAPPINGS, "ip_mapper_null_field", "Error parsing [" + nullValue.getValue() + "] as IP in [null_value] on field [" + name() + "]); [null_value] will be ignored"); return null; } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java index 2b53ac6a0ff4..6875ea191a4f 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java @@ -155,7 +155,7 @@ public class ObjectMapper extends Mapper implements Cloneable { } return true; } else if (fieldName.equals("include_in_all")) { - deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "include_in_all", + deprecationLogger.critical(DeprecationCategory.MAPPINGS, "include_in_all", "[include_in_all] is deprecated, the _all field have been removed in this version"); return true; } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/RootObjectMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/RootObjectMapper.java index 1311af611f2f..2477e3fed554 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/RootObjectMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/RootObjectMapper.java @@ -443,7 +443,7 @@ public class RootObjectMapper extends ObjectMapper { if (failInvalidDynamicTemplates) { throw new IllegalArgumentException(message, lastError); } else { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.TEMPLATES, "invalid_dynamic_template", + DEPRECATION_LOGGER.critical(DeprecationCategory.TEMPLATES, "invalid_dynamic_template", "{}, last error: [{}]", message, lastError.getMessage()); } } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java index 1d3ffd2c3e3a..3ef1d55056d0 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java @@ -92,7 +92,7 @@ public class TypeParsers { // For indices created prior to 8.0, we only emit a deprecation warning and do not fail type parsing. This is to // maintain the backwards-compatibility guarantee that we can always load indexes from the previous major version. if (parserContext.indexVersionCreated().before(Version.V_8_0_0)) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.INDICES, "multifield_within_multifield", "At least one multi-field, [" diff --git a/server/src/main/java/org/elasticsearch/index/query/AbstractGeometryQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/AbstractGeometryQueryBuilder.java index 32fe4f649c08..f9ba9cdb87c2 100644 --- a/server/src/main/java/org/elasticsearch/index/query/AbstractGeometryQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/AbstractGeometryQueryBuilder.java @@ -522,7 +522,7 @@ public abstract class AbstractGeometryQueryBuilder } public static TypeQueryV7Builder fromXContent(XContentParser parser) throws IOException { - deprecationLogger.compatibleApiWarning("type_query", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("type_query", TYPES_DEPRECATION_MESSAGE); throw new ParsingException(parser.getTokenLocation(), TYPES_DEPRECATION_MESSAGE); } diff --git a/server/src/main/java/org/elasticsearch/index/query/functionscore/RandomScoreFunctionBuilder.java b/server/src/main/java/org/elasticsearch/index/query/functionscore/RandomScoreFunctionBuilder.java index 8372fa8440ba..45db8d9294c3 100644 --- a/server/src/main/java/org/elasticsearch/index/query/functionscore/RandomScoreFunctionBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/functionscore/RandomScoreFunctionBuilder.java @@ -147,7 +147,7 @@ public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder> FUNCTIONS = Map.of( "_type", value -> { - deprecationLogger.deprecate(DeprecationCategory.INDICES, "conditional-processor__type", + deprecationLogger.critical(DeprecationCategory.INDICES, "conditional-processor__type", "[types removal] Looking up doc types [_type] in scripts is deprecated."); return value; }); diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index 17ed31639cc4..25578c903099 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -306,7 +306,7 @@ public class Node implements Closeable { logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk()); } else { logger.info("JVM home [{}]", System.getProperty("java.home")); - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.OTHER, "no-jdk", "no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release"); @@ -320,7 +320,7 @@ public class Node implements Closeable { if (Environment.PATH_SHARED_DATA_SETTING.exists(tmpSettings)) { // NOTE: this must be done with an explicit check here because the deprecation property on a path setting will // cause ES to fail to start since logging is not yet initialized on first read of the setting - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.SETTINGS, "shared-data-path", "setting [path.shared_data] is deprecated and will be removed in a future release" diff --git a/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java b/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java index 35929a6f191e..f8f633245a64 100644 --- a/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java @@ -59,9 +59,9 @@ public class DeprecationRestHandler implements RestHandler { @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { if (compatibleVersionWarning == false) { - deprecationLogger.deprecate(DeprecationCategory.API, deprecationKey, deprecationMessage); + deprecationLogger.critical(DeprecationCategory.API, deprecationKey, deprecationMessage); } else { - deprecationLogger.compatibleApiWarning(deprecationKey, deprecationMessage); + deprecationLogger.compatibleCritical(deprecationKey, deprecationMessage); } handler.handleRequest(request, channel, client); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 07f5edeb4769..a38a3d3b9781 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -77,7 +77,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if(request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("types")){ - deprecationLogger.compatibleApiWarning("nodes_stats_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("nodes_stats_types", TYPES_DEPRECATION_MESSAGE); request.param("types"); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 47e7839a3d24..cc580e74ef1b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -49,7 +49,7 @@ public class RestCloseIndexAction extends BaseRestHandler { closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions())); String waitForActiveShards = request.param("wait_for_active_shards"); if ("index-setting".equalsIgnoreCase(waitForActiveShards)) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "close-index-wait_for_active_shards-index-setting", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "close-index-wait_for_active_shards-index-setting", "?wait_for_active_shards=index-setting is now the default behaviour; the 'index-setting' value for this parameter " + "should no longer be used since it will become unsupported in version " + (Version.V_7_0_0.major + 2)); // TODO in v9: diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index 18863001e777..c5b43233340c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -62,7 +62,7 @@ public class RestCreateIndexAction extends BaseRestHandler { CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index")); if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { request.param(INCLUDE_TYPE_NAME_PARAMETER);// just consume, it is always replaced with _doc - deprecationLogger.compatibleApiWarning("create_index_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("create_index_with_types", TYPES_DEPRECATION_MESSAGE); } if (request.hasContent()) { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 737a9819673d..6c69897a7759 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -67,7 +67,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler { if (request.getRestApiVersion() == RestApiVersion.V_7) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { - deprecationLogger.compatibleApiWarning("get_field_mapping_with_types", INCLUDE_TYPE_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("get_field_mapping_with_types", INCLUDE_TYPE_DEPRECATION_MESSAGE); } boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); @@ -77,7 +77,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler { if (request.hasParam("local")) { request.param("local"); - deprecationLogger.compatibleApiWarning( + deprecationLogger.compatibleCritical( "get_field_mapping_local", "Use [local] in get field mapping requests is deprecated. " + "The parameter will be removed in the next major version" ); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index 9379205808c8..d5aadbdd9be2 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -57,7 +57,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { - deprecationLogger.compatibleApiWarning("get_index_template_include_type_name", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("get_index_template_include_type_name", TYPES_DEPRECATION_MESSAGE); } final String[] names = Strings.splitStringByCommaToArray(request.param("name")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index 6079b3efa206..6c2441947b1c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -59,7 +59,7 @@ public class RestGetIndicesAction extends BaseRestHandler { // starting with 7.0 we don't include types by default in the response to GET requests if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) && request.method().equals(GET)) { - deprecationLogger.compatibleApiWarning("get_indices_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("get_indices_with_types", TYPES_DEPRECATION_MESSAGE); } String[] indices = Strings.splitStringByCommaToArray(request.param("index")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index b4b175018a1e..e71a2b2e3336 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -70,7 +70,7 @@ public class RestGetMappingAction extends BaseRestHandler { if (request.getRestApiVersion() == RestApiVersion.V_7) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { request.param(INCLUDE_TYPE_NAME_PARAMETER); - deprecationLogger.compatibleApiWarning("get_mapping_with_types", INCLUDE_TYPE_DEPRECATION_MSG); + deprecationLogger.compatibleCritical("get_mapping_with_types", INCLUDE_TYPE_DEPRECATION_MSG); } final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); if (request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY) == false && types.length > 0) { @@ -78,7 +78,7 @@ public class RestGetMappingAction extends BaseRestHandler { " include_type_name is set to true."); } if (request.method().equals(HEAD)) { - deprecationLogger.compatibleApiWarning("get_mapping_types_removal", + deprecationLogger.compatibleCritical("get_mapping_types_removal", "Type exists requests are deprecated, as types have been deprecated."); } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index 0fe0a93e07f4..0177a38ee289 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -71,7 +71,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if(request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("types")){ - deprecationLogger.compatibleApiWarning("indices_stats_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("indices_stats_types", TYPES_DEPRECATION_MESSAGE); request.param("types"); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index c80b36db2ee0..1aac17865de1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -55,7 +55,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name")); if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("template")) { - deprecationLogger.compatibleApiWarning("template_parameter_deprecation", + deprecationLogger.compatibleCritical("template_parameter_deprecation", "Deprecated parameter [template] used, replaced by [index_patterns]"); putRequest.patterns(List.of(request.param("template"))); } else { @@ -70,7 +70,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { request.getXContentType()).v2(); if(request.getRestApiVersion() == RestApiVersion.V_7) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) ) { - deprecationLogger.compatibleApiWarning("put_index_template_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("put_index_template_with_types", TYPES_DEPRECATION_MESSAGE); } boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); if(includeTypeName) { @@ -82,7 +82,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { sourceAsMap = RestCreateIndexAction.prepareMappings(sourceAsMap); } if (request.getRestApiVersion() == RestApiVersion.V_7 && sourceAsMap.containsKey("template")) { - deprecationLogger.compatibleApiWarning("template_field_deprecation", + deprecationLogger.compatibleCritical("template_field_deprecation", "Deprecated field [template] used, replaced by [index_patterns]"); putRequest.patterns(List.of((String) sourceAsMap.remove("template"))); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index c1e6ad3874e2..b4cd7a9defd3 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -70,7 +70,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.compatibleApiWarning("put_mapping_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("put_mapping_with_types", TYPES_DEPRECATION_MESSAGE); } final String type = request.param("type"); if (includeTypeName == false && diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index 48b5855d6d6c..7fa1bd935ace 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -39,7 +39,7 @@ public abstract class RestResizeHandler extends BaseRestHandler { @Override public final RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("copy_settings")) { - deprecationLogger.compatibleApiWarning("copy_settings", "parameter [copy_settings] is deprecated and will be removed in 8.0.0"); + deprecationLogger.compatibleCritical("copy_settings", "parameter [copy_settings] is deprecated and will be removed in 8.0.0"); final String rawCopySettings = request.param("copy_settings"); final boolean copySettings = Booleans.parseBoolean(rawCopySettings); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index 1b2d50add5e8..2ad3dd023ec1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -57,7 +57,7 @@ public class RestRolloverIndexAction extends BaseRestHandler { boolean includeTypeName = false; if (request.getRestApiVersion() == RestApiVersion.V_7) { if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER)) { - deprecationLogger.compatibleApiWarning("index_rollover_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("index_rollover_with_types", TYPES_DEPRECATION_MESSAGE); } includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index dde5f658d488..315169cb3220 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -59,7 +59,7 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { - deprecationLogger.compatibleApiWarning("validate_query_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("validate_query_with_types", TYPES_DEPRECATION_MESSAGE); request.param("type"); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index 7c7c447652aa..8591bf87a582 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -64,7 +64,7 @@ public class RestGetSourceAction extends BaseRestHandler { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { request.param("type"); // consume and ignore the type - deprecationLogger.compatibleApiWarning("get_source_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("get_source_with_types", TYPES_DEPRECATION_MESSAGE); } final GetRequest getRequest = new GetRequest(request.param("index"), request.param("id")); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index ec0cf8cd9cce..50e0b206ab64 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -53,7 +53,7 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { request.param("type"); - deprecationLogger.compatibleApiWarning(DeprecationRestHandler.DEPRECATED_ROUTE_KEY, TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical(DeprecationRestHandler.DEPRECATED_ROUTE_KEY, TYPES_DEPRECATION_MESSAGE); } MultiTermVectorsRequest multiTermVectorsRequest = new MultiTermVectorsRequest(); TermVectorsRequest template = new TermVectorsRequest() diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java index faf310e4ae10..2b45963f71f6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestCountAction.java @@ -59,7 +59,7 @@ public class RestCountAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { - deprecationLogger.compatibleApiWarning("count_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("count_with_types", TYPES_DEPRECATION_MESSAGE); request.param("type"); } SearchRequest countRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 5ee3debf0682..4c9a999f2df9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -131,7 +131,7 @@ public class RestSearchAction extends BaseRestHandler { IntConsumer setSize) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { request.param("type"); - deprecationLogger.compatibleApiWarning("search_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("search_with_types", TYPES_DEPRECATION_MESSAGE); } if (searchRequest.source() == null) { @@ -209,7 +209,7 @@ public class RestSearchAction extends BaseRestHandler { int size = request.paramAsInt("size", SearchService.DEFAULT_SIZE); if (request.getRestApiVersion() == RestApiVersion.V_7 && size == -1) { // we treat -1 as not-set, but deprecate it to be able to later remove this funny extra treatment - deprecationLogger.compatibleApiWarning( + deprecationLogger.compatibleCritical( "search-api-size-1", "Using search size of -1 is deprecated and will be removed in future versions. " + "Instead, don't use the `size` parameter if you don't want to set it explicitly." diff --git a/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java b/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java index 2fe1e2542b45..5b7dd0a59886 100644 --- a/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java +++ b/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java @@ -24,13 +24,13 @@ abstract class AbstractSortScript extends DocBasedScript implements ScorerAware private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "sort-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "sort-script_doc", "Accessing variable [doc] via [params.doc] from within an sort-script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "sort-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "sort-script__doc", "Accessing variable [doc] via [params._doc] from within an sort-script " + "is deprecated in favor of directly accessing [doc]."); return value; diff --git a/server/src/main/java/org/elasticsearch/script/AggregationScript.java b/server/src/main/java/org/elasticsearch/script/AggregationScript.java index b91d126dad2d..d904863f6787 100644 --- a/server/src/main/java/org/elasticsearch/script/AggregationScript.java +++ b/server/src/main/java/org/elasticsearch/script/AggregationScript.java @@ -30,13 +30,13 @@ public abstract class AggregationScript extends DocBasedScript implements Scorer private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "aggregation-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "aggregation-script_doc", "Accessing variable [doc] via [params.doc] from within an aggregation-script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "aggregation-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "aggregation-script__doc", "Accessing variable [doc] via [params._doc] from within an aggregation-script " + "is deprecated in favor of directly accessing [doc]."); return value; diff --git a/server/src/main/java/org/elasticsearch/script/FieldScript.java b/server/src/main/java/org/elasticsearch/script/FieldScript.java index 42c7a75a2a52..11b3a516c3a6 100644 --- a/server/src/main/java/org/elasticsearch/script/FieldScript.java +++ b/server/src/main/java/org/elasticsearch/script/FieldScript.java @@ -29,13 +29,13 @@ public abstract class FieldScript extends DocBasedScript { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "field-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "field-script_doc", "Accessing variable [doc] via [params.doc] from within an field-script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "field-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "field-script__doc", "Accessing variable [doc] via [params._doc] from within an field-script " + "is deprecated in favor of directly accessing [doc]."); return value; diff --git a/server/src/main/java/org/elasticsearch/script/JodaCompatibleZonedDateTime.java b/server/src/main/java/org/elasticsearch/script/JodaCompatibleZonedDateTime.java index 93e5fe7d8949..f88103ef8a71 100644 --- a/server/src/main/java/org/elasticsearch/script/JodaCompatibleZonedDateTime.java +++ b/server/src/main/java/org/elasticsearch/script/JodaCompatibleZonedDateTime.java @@ -58,7 +58,7 @@ public class JodaCompatibleZonedDateTime @SuppressLoggerChecks(reason = "safely delegates to logger") @Override public Void run() { - deprecationLogger.deprecate(category, key, message, params); + deprecationLogger.critical(category, key, message, params); return null; } }); diff --git a/server/src/main/java/org/elasticsearch/script/ScoreScript.java b/server/src/main/java/org/elasticsearch/script/ScoreScript.java index 865e49c0b2f6..2b2f96dd198e 100644 --- a/server/src/main/java/org/elasticsearch/script/ScoreScript.java +++ b/server/src/main/java/org/elasticsearch/script/ScoreScript.java @@ -53,13 +53,13 @@ public abstract class ScoreScript extends DocBasedScript { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "score-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "score-script_doc", "Accessing variable [doc] via [params.doc] from within an score-script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "score-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "score-script__doc", "Accessing variable [doc] via [params._doc] from within an score-script " + "is deprecated in favor of directly accessing [doc]."); return value; diff --git a/server/src/main/java/org/elasticsearch/script/ScriptMetadata.java b/server/src/main/java/org/elasticsearch/script/ScriptMetadata.java index 765b63bfb859..8f8b958b832a 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptMetadata.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptMetadata.java @@ -208,13 +208,13 @@ public final class ScriptMetadata implements Metadata.Custom, Writeable, ToXCont if (source.getSource().isEmpty()) { if (source.getLang().equals(Script.DEFAULT_TEMPLATE_LANG)) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.TEMPLATES, "empty_templates", "empty templates should no longer be used" ); } else { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.TEMPLATES, "empty_scripts", "empty scripts should no longer be used" diff --git a/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java b/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java index c74788776d13..b15a234aa180 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java @@ -57,18 +57,18 @@ public class ScriptedMetricAggContexts { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "map-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "map-script_doc", "Accessing variable [doc] via [params.doc] from within an scripted metric agg map script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "map-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "map-script__doc", "Accessing variable [doc] via [params._doc] from within an scripted metric agg map script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_agg", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "map-script__agg", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "map-script__agg", "Accessing variable [_agg] via [params._agg] from within a scripted metric agg map script " + "is deprecated in favor of using [state]."); return value; diff --git a/server/src/main/java/org/elasticsearch/script/StoredScriptSource.java b/server/src/main/java/org/elasticsearch/script/StoredScriptSource.java index bd8e854cb954..afcbd4ba0776 100644 --- a/server/src/main/java/org/elasticsearch/script/StoredScriptSource.java +++ b/server/src/main/java/org/elasticsearch/script/StoredScriptSource.java @@ -134,10 +134,10 @@ public class StoredScriptSource extends AbstractDiffable imp if (source == null) { if (ignoreEmpty || Script.DEFAULT_TEMPLATE_LANG.equals(lang)) { if (Script.DEFAULT_TEMPLATE_LANG.equals(lang)) { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "empty_templates", + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "empty_templates", "empty templates should no longer be used"); } else { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "empty_scripts", + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "empty_scripts", "empty scripts should no longer be used"); } } else { @@ -146,10 +146,10 @@ public class StoredScriptSource extends AbstractDiffable imp } else if (source.isEmpty()) { if (ignoreEmpty || Script.DEFAULT_TEMPLATE_LANG.equals(lang)) { if (Script.DEFAULT_TEMPLATE_LANG.equals(lang)) { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "empty_templates", + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "empty_templates", "empty templates should no longer be used"); } else { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "empty_scripts", + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "empty_scripts", "empty scripts should no longer be used"); } } else { @@ -250,7 +250,7 @@ public class StoredScriptSource extends AbstractDiffable imp token = parser.nextToken(); if (token == Token.END_OBJECT) { - deprecationLogger.deprecate(DeprecationCategory.TEMPLATES, "empty_templates", "empty templates should no longer be used"); + deprecationLogger.critical(DeprecationCategory.TEMPLATES, "empty_templates", "empty templates should no longer be used"); return new StoredScriptSource(Script.DEFAULT_TEMPLATE_LANG, "", Collections.emptyMap()); } diff --git a/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java b/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java index 522268b6ad42..f2b15115dd5d 100644 --- a/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java +++ b/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java @@ -29,13 +29,13 @@ public abstract class TermsSetQueryScript { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class); private static final Map> PARAMS_FUNCTIONS = Map.of( "doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "terms-set-query-script_doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "terms-set-query-script_doc", "Accessing variable [doc] via [params.doc] from within an terms-set-query-script " + "is deprecated in favor of directly accessing [doc]."); return value; }, "_doc", value -> { - deprecationLogger.deprecate(DeprecationCategory.SCRIPTING, "terms-set-query-script__doc", + deprecationLogger.critical(DeprecationCategory.SCRIPTING, "terms-set-query-script__doc", "Accessing variable [doc] via [params._doc] from within an terms-set-query-script " + "is deprecated in favor of directly accessing [doc]."); return value; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java b/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java index 57f92d785dbe..2ff631bc265c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java @@ -577,7 +577,7 @@ public abstract class InternalOrder extends BucketOrder { } // _term and _time order deprecated in 6.0; replaced by _key if (parser.getRestApiVersion() == RestApiVersion.V_7 && ("_term".equals(orderKey) || "_time".equals(orderKey))) { - deprecationLogger.compatibleApiWarning( + deprecationLogger.compatibleCritical( "_term_and_time_key_removal", "Deprecated aggregation order key [{}] used, replaced by [_key]", orderKey diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregatorFactory.java index a1f1427da857..434265a2cae5 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregatorFactory.java @@ -51,7 +51,7 @@ public final class AutoDateHistogramAggregatorFactory extends ValuesSourceAggreg CardinalityUpperBound cardinality, Map metadata) -> { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.AGGREGATIONS, "auto-date-histogram-boolean", "Running AutoIntervalDateHistogram aggregations on [boolean] fields is deprecated" diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java index 2f996a1fe0a9..b20230a1aa6f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorFactory.java @@ -56,7 +56,7 @@ public final class DateHistogramAggregatorFactory extends ValuesSourceAggregator parent, cardinality, metadata) -> { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.AGGREGATIONS, "date-histogram-boolean", "Running DateHistogram aggregations on [boolean] fields is deprecated" diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateIntervalWrapper.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateIntervalWrapper.java index 5c5c97a7f4af..c3d38bbd7a71 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateIntervalWrapper.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateIntervalWrapper.java @@ -104,7 +104,7 @@ public class DateIntervalWrapper implements ToXContentFragment, Writeable { but immediately adapt it into either fixed or calendar interval. */ parser.declareField((wrapper, interval) -> { - DEPRECATION_LOGGER.deprecate(DeprecationCategory.AGGREGATIONS, "date-interval-getter", DEPRECATION_TEXT); + DEPRECATION_LOGGER.critical(DeprecationCategory.AGGREGATIONS, "date-interval-getter", DEPRECATION_TEXT); if (interval instanceof Long) { wrapper.fixedInterval(new DateHistogramInterval(interval + "ms")); } else { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/DateRangeAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/DateRangeAggregationBuilder.java index d7e18e2231e4..cfb1914ce21d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/DateRangeAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/DateRangeAggregationBuilder.java @@ -71,7 +71,7 @@ public class DateRangeAggregationBuilder extends AbstractRangeBuilder metadata) -> { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.AGGREGATIONS, "Range-boolean", "Running Range or DateRange aggregations on [boolean] fields is deprecated" diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantTermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantTermsAggregatorFactory.java index 5f98383f1293..20ef055587de 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantTermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/SignificantTermsAggregatorFactory.java @@ -372,7 +372,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac if ("global_ordinals".equals(value)) { return GLOBAL_ORDINALS; } else if ("global_ordinals_hash".equals(value)) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.AGGREGATIONS, "global_ordinals_hash", "global_ordinals_hash is deprecated. Please use [global_ordinals] instead." diff --git a/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index d2369be7a494..360e6e41925a 100644 --- a/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -1124,7 +1124,7 @@ public final class SearchSourceBuilder implements Writeable, ToXContentObject, R int parsedSize = parser.intValue(); if (parser.getRestApiVersion() == RestApiVersion.V_7 && parsedSize == -1) { // we treat -1 as not-set, but deprecate it to be able to later remove this funny extra treatment - deprecationLogger.compatibleApiWarning( + deprecationLogger.compatibleCritical( "search-api-size-1", "Using search size of -1 is deprecated and will be removed in future versions. " + "Instead, don't use the `size` parameter if you don't want to set it explicitly." @@ -1180,7 +1180,7 @@ public final class SearchSourceBuilder implements Writeable, ToXContentObject, R } } else if (parser.getRestApiVersion() == RestApiVersion.V_7 && INDICES_BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { - deprecationLogger.compatibleApiWarning("indices_boost_object_format", + deprecationLogger.compatibleCritical("indices_boost_object_format", "Object format in indices_boost is deprecated, please use array format instead"); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldAndFormat.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldAndFormat.java index 6f5550c01009..d2932ea09d32 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldAndFormat.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldAndFormat.java @@ -64,7 +64,7 @@ public final class FieldAndFormat implements Writeable, ToXContentObject { } else { String text = p.text(); if (text.equals(USE_DEFAULT_FORMAT)) { - DEPRECATION_LOGGER.compatibleApiWarning("explicit_default_format", + DEPRECATION_LOGGER.compatibleCritical("explicit_default_format", "[" + USE_DEFAULT_FORMAT + "] is a special format that was only used to " + "ease the transition to 7.x. It has become the default and shouldn't be set explicitly anymore."); return null; diff --git a/server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java b/server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java index 75fb86841a37..92608968de24 100644 --- a/server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java @@ -411,7 +411,7 @@ public class GeoDistanceSortBuilder extends SortBuilder } else if (token == XContentParser.Token.START_OBJECT) { if (parser.getRestApiVersion() == RestApiVersion.V_7 && NESTED_FILTER_FIELD.match(currentName, parser.getDeprecationHandler())) { - deprecationLogger.compatibleApiWarning("nested_filter", + deprecationLogger.compatibleCritical("nested_filter", "[nested_filter] has been removed in favour of the [nested] parameter"); throw new ParsingException( parser.getTokenLocation(), @@ -436,7 +436,7 @@ public class GeoDistanceSortBuilder extends SortBuilder } else if (token.isValue()) { if (parser.getRestApiVersion() == RestApiVersion.V_7 && NESTED_PATH_FIELD.match(currentName, parser.getDeprecationHandler())) { - deprecationLogger.compatibleApiWarning("nested_path", + deprecationLogger.compatibleCritical("nested_path", "[nested_path] has been removed in favour of the [nested] parameter"); throw new ParsingException( parser.getTokenLocation(), diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java index 899d1908ca55..700dbafd1622 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java @@ -280,7 +280,7 @@ public class GeoContextMapping extends ContextMapping { MappedFieldType mappedFieldType = fieldResolver.apply(fieldName); if (mappedFieldType == null) { if (indexVersionCreated.before(Version.V_7_0_0)) { - deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "geo_context_mapping", + deprecationLogger.critical(DeprecationCategory.MAPPINGS, "geo_context_mapping", "field [{}] referenced in context [{}] is not defined in the mapping", fieldName, name); } else { throw new ElasticsearchParseException( @@ -288,7 +288,7 @@ public class GeoContextMapping extends ContextMapping { } } else if (GeoPointFieldMapper.CONTENT_TYPE.equals(mappedFieldType.typeName()) == false) { if (indexVersionCreated.before(Version.V_7_0_0)) { - deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "geo_context_mapping", + deprecationLogger.critical(DeprecationCategory.MAPPINGS, "geo_context_mapping", "field [{}] referenced in context [{}] must be mapped to geo_point, found [{}]", fieldName, name, mappedFieldType.typeName()); } else { diff --git a/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java b/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java index c05b0a5d01c9..be817c71885e 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java @@ -401,7 +401,7 @@ public class RestoreService implements ClusterStateApplier { // log a deprecation warning if the any of the indexes to delete were included in the request and the snapshot // is from a version that should have feature states if (snapshotInfo.version().onOrAfter(Version.V_7_12_0) && explicitlyRequestedSystemIndices.isEmpty() == false) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.API, "restore-system-index-from-snapshot", "Restoring system indices by name is deprecated. Use feature states instead. System indices: " diff --git a/server/src/main/java/org/elasticsearch/transport/TransportInfo.java b/server/src/main/java/org/elasticsearch/transport/TransportInfo.java index c72d2d53f188..e952a563d333 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportInfo.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportInfo.java @@ -91,7 +91,7 @@ public class TransportInfo implements ReportingService.Info { if (InetAddresses.isInetAddress(hostString) == false) { publishAddressString = hostString + '/' + publishAddress.toString(); if (cnameInPublishAddressProperty) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "cname_in_publish_address", + deprecationLogger.critical(DeprecationCategory.SETTINGS, "cname_in_publish_address", "es.transport.cname_in_publish_address system property is deprecated and no longer affects " + propertyName + " formatting. Remove this property to get rid of this deprecation warning."); } diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java index 030fd6269280..f33480a0bb63 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java @@ -107,14 +107,14 @@ public class TransportAnalyzeActionTests extends ESTestCase { @Override public TokenStream create(TokenStream tokenStream) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "deprecated_token_filter_create", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "deprecated_token_filter_create", "Using deprecated token filter [deprecated]"); return tokenStream; } @Override public TokenStream normalize(TokenStream tokenStream) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "deprecated_token_filter_normalize", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "deprecated_token_filter_normalize", "Using deprecated token filter [deprecated]"); return tokenStream; } diff --git a/server/src/test/java/org/elasticsearch/index/analysis/AnalysisRegistryTests.java b/server/src/test/java/org/elasticsearch/index/analysis/AnalysisRegistryTests.java index 5047a6f3dcb3..9b236af8d7ff 100644 --- a/server/src/test/java/org/elasticsearch/index/analysis/AnalysisRegistryTests.java +++ b/server/src/test/java/org/elasticsearch/index/analysis/AnalysisRegistryTests.java @@ -314,7 +314,7 @@ public class AnalysisRegistryTests extends ESTestCase { @Override public TokenStream create(TokenStream tokenStream) { if (indexSettings.getIndexVersionCreated().equals(Version.CURRENT)) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "deprecated_token_filter", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "deprecated_token_filter", "Using deprecated token filter [deprecated]"); } return tokenStream; @@ -343,7 +343,7 @@ public class AnalysisRegistryTests extends ESTestCase { @Override public TokenStream create(TokenStream tokenStream) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "unused_token_filter", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "unused_token_filter", "Using deprecated token filter [unused]"); return tokenStream; } @@ -357,7 +357,7 @@ public class AnalysisRegistryTests extends ESTestCase { @Override public TokenStream create(TokenStream tokenStream) { - deprecationLogger.deprecate(DeprecationCategory.ANALYSIS, "deprecated_normalizer", + deprecationLogger.critical(DeprecationCategory.ANALYSIS, "deprecated_normalizer", "Using deprecated token filter [deprecated_normalizer]"); return tokenStream; } diff --git a/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java b/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java index 609215869de4..18a12425c54d 100644 --- a/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java @@ -76,10 +76,10 @@ public class DeprecationRestHandlerTests extends ESTestCase { // log, then forward if (compatibleVersionWarning) { inOrder.verify(deprecationLogger) - .compatibleApiWarning("deprecated_route_GET_/some/path", deprecationMessage); + .compatibleCritical("deprecated_route_GET_/some/path", deprecationMessage); } else { inOrder.verify(deprecationLogger) - .deprecate(DeprecationCategory.API, "deprecated_route_GET_/some/path", deprecationMessage); + .critical(DeprecationCategory.API, "deprecated_route_GET_/some/path", deprecationMessage); } inOrder.verify(handler).handleRequest(request, channel, client); diff --git a/test/logger-usage/src/test/java/org/elasticsearch/test/loggerusage/ESLoggerUsageTests.java b/test/logger-usage/src/test/java/org/elasticsearch/test/loggerusage/ESLoggerUsageTests.java index 3bd2e8c3382f..1b8194f7f87c 100644 --- a/test/logger-usage/src/test/java/org/elasticsearch/test/loggerusage/ESLoggerUsageTests.java +++ b/test/logger-usage/src/test/java/org/elasticsearch/test/loggerusage/ESLoggerUsageTests.java @@ -253,7 +253,7 @@ public class ESLoggerUsageTests extends ESTestCase { public void checkDeprecationLogger() { DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ESLoggerUsageTests.class); - deprecationLogger.deprecate(DeprecationCategory.OTHER, "key","message {}", 123); + deprecationLogger.critical(DeprecationCategory.OTHER, "key","message {}", 123); } } diff --git a/x-pack/plugin/async-search/qa/rest/src/main/java/org/elasticsearch/query/DeprecatedQueryBuilder.java b/x-pack/plugin/async-search/qa/rest/src/main/java/org/elasticsearch/query/DeprecatedQueryBuilder.java index 081d55086b9b..bb9ac4163d0b 100644 --- a/x-pack/plugin/async-search/qa/rest/src/main/java/org/elasticsearch/query/DeprecatedQueryBuilder.java +++ b/x-pack/plugin/async-search/qa/rest/src/main/java/org/elasticsearch/query/DeprecatedQueryBuilder.java @@ -55,7 +55,7 @@ public class DeprecatedQueryBuilder extends AbstractQueryBuilder - deprecationLogger.deprecate(DeprecationCategory.SECURITY, + deprecationLogger.critical(DeprecationCategory.SECURITY, "[" + indexOrAlias + "] mapping update for ingest privilege [" + privilegeName + "]", "the index privilege [" + privilegeName + "] allowed the update " + "mapping action [" + action + "] on index [" + indexOrAlias + "], this privilege " + diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformAction.java index 97dbef1d0102..b9402c003bc6 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformAction.java @@ -125,7 +125,7 @@ public class GetTransformAction extends ActionType builder.field(TransformField.COUNT.getPreferredName(), invalidTransforms.size()); builder.field(TransformField.TRANSFORMS.getPreferredName(), invalidTransforms); builder.endObject(); - deprecationLogger.deprecate(DeprecationCategory.OTHER, "invalid_transforms", + deprecationLogger.critical(DeprecationCategory.OTHER, "invalid_transforms", INVALID_TRANSFORMS_DEPRECATION_WARNING, invalidTransforms.size()); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/PivotConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/PivotConfig.java index 2529f559f49a..02fb909299f7 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/PivotConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/PivotConfig.java @@ -83,7 +83,7 @@ public class PivotConfig implements Writeable, ToXContentObject { this.maxPageSearchSize = maxPageSearchSize; if (maxPageSearchSize != null) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.API, TransformField.MAX_PAGE_SEARCH_SIZE.getPreferredName(), "[max_page_search_size] is deprecated inside pivot please use settings instead" diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedAggregationBuilder.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedAggregationBuilder.java index 47ee429eaa39..ccf11eb1167d 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedAggregationBuilder.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedAggregationBuilder.java @@ -97,7 +97,7 @@ public class MockDeprecatedAggregationBuilder extends ValuesSourceAggregationBui } public static MockDeprecatedAggregationBuilder fromXContent(XContentParser p) { - deprecationLogger.deprecate(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE); + deprecationLogger.critical(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE); return new MockDeprecatedAggregationBuilder(); } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedQueryBuilder.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedQueryBuilder.java index 622f0d00c6a7..acbc8f655092 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedQueryBuilder.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/MockDeprecatedQueryBuilder.java @@ -46,7 +46,7 @@ public class MockDeprecatedQueryBuilder extends AbstractQueryBuilder { + Response response; + try { + client().performRequest(new Request("POST", "/" + DATA_STREAM_NAME + "/_refresh?ignore_unavailable=true")); + response = client().performRequest(new Request("GET", "/" + DATA_STREAM_NAME + "/_search")); + } catch (Exception e) { + // It can take a moment for the index to be created. If it doesn't exist then the client + // throws an exception. Translate it into an assertion error so that assertBusy() will + // continue trying. + throw new AssertionError(e); + } + assertOK(response); + + ObjectMapper mapper = new ObjectMapper(); + final JsonNode jsonNode = mapper.readTree(response.getEntity().getContent()); + + final int hits = jsonNode.at("/hits/total/value").intValue(); + assertThat(hits, greaterThan(0)); + + List> documents = new ArrayList<>(); + + for (int i = 0; i < hits; i++) { + final JsonNode hit = jsonNode.at("/hits/hits/" + i + "/_source"); + + final Map document = new HashMap<>(); + hit.fields().forEachRemaining(entry -> document.put(entry.getKey(), entry.getValue().textValue())); + + documents.add(document); + } + + logger.warn(documents); + assertThat(documents, hasSize(2)); + + assertThat( + documents, + hasItems( + allOf( + hasKey("@timestamp"), + hasKey("elasticsearch.cluster.name"), + hasKey("elasticsearch.cluster.uuid"), + hasEntry(X_OPAQUE_ID_FIELD_NAME, "some xid"), + hasEntry("elasticsearch.event.category", "settings"), + hasKey("elasticsearch.node.id"), + hasKey("elasticsearch.node.name"), + hasEntry("data_stream.dataset", "deprecation.elasticsearch"), + hasEntry("data_stream.namespace", "default"), + hasEntry("data_stream.type", "logs"), + hasEntry("ecs.version", "1.7"), + hasEntry(KEY_FIELD_NAME, "deprecated_warn_settings"), + hasEntry("event.dataset", "deprecation.elasticsearch"), + hasEntry("log.level", "WARN"), + hasKey("log.logger"), + hasEntry("message", "[deprecated_warn_settings] usage is deprecated but won't be breaking in next version") + ), + allOf( + hasKey("@timestamp"), + hasKey("elasticsearch.cluster.name"), + hasKey("elasticsearch.cluster.uuid"), + hasEntry(X_OPAQUE_ID_FIELD_NAME, "some xid"), + hasEntry("elasticsearch.event.category", "api"), + hasKey("elasticsearch.node.id"), + hasKey("elasticsearch.node.name"), + hasEntry("data_stream.dataset", "deprecation.elasticsearch"), + hasEntry("data_stream.namespace", "default"), + hasEntry("data_stream.type", "logs"), + hasEntry("ecs.version", "1.7"), + hasEntry(KEY_FIELD_NAME, "deprecated_route_GET_/_test_cluster/deprecated_settings"), + hasEntry("event.dataset", "deprecation.elasticsearch"), + hasEntry("log.level", "CRITICAL"), hasKey("log.logger"), hasEntry("message", "[/_test_cluster/deprecated_settings] exists for deprecated tests") ) @@ -423,7 +528,10 @@ public class DeprecationHttpIT extends ESRestTestCase { .build(); compatibleRequest.setOptions(compatibleOptions); compatibleRequest.setEntity( - buildSettingsRequest(Collections.singletonList(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1), true) + buildSettingsRequest( + Collections.singletonList(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1), + "deprecated_settings" + ) ); Response deprecatedApiResponse = client().performRequest(compatibleRequest); assertOK(deprecatedApiResponse); @@ -436,7 +544,6 @@ public class DeprecationHttpIT extends ESRestTestCase { actualWarningValues, containsInAnyOrder( TestDeprecationHeaderRestAction.DEPRECATED_ENDPOINT, - TestDeprecationHeaderRestAction.DEPRECATED_USAGE, TestDeprecationHeaderRestAction.COMPATIBLE_API_USAGE ) ); @@ -472,7 +579,7 @@ public class DeprecationHttpIT extends ESRestTestCase { } logger.warn(documents); - assertThat(documents, hasSize(3)); + assertThat(documents, hasSize(2)); assertThat( documents, @@ -491,28 +598,10 @@ public class DeprecationHttpIT extends ESRestTestCase { hasEntry("ecs.version", "1.7"), hasEntry(KEY_FIELD_NAME, "compatible_key"), hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasKey("log.logger"), hasEntry("message", "You are using a compatible API for this request") ), - allOf( - hasKey("@timestamp"), - hasKey("elasticsearch.cluster.name"), - hasKey("elasticsearch.cluster.uuid"), - hasEntry(X_OPAQUE_ID_FIELD_NAME, "some xid"), - hasEntry("elasticsearch.event.category", "settings"), - hasKey("elasticsearch.node.id"), - hasKey("elasticsearch.node.name"), - hasEntry("data_stream.dataset", "deprecation.elasticsearch"), - hasEntry("data_stream.namespace", "default"), - hasEntry("data_stream.type", "logs"), - hasEntry("ecs.version", "1.7"), - hasEntry(KEY_FIELD_NAME, "deprecated_settings"), - hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), - hasKey("log.logger"), - hasEntry("message", "[deprecated_settings] usage is deprecated. use [settings] instead") - ), allOf( hasKey("@timestamp"), hasKey("elasticsearch.cluster.name"), @@ -527,7 +616,7 @@ public class DeprecationHttpIT extends ESRestTestCase { hasEntry("ecs.version", "1.7"), hasEntry(KEY_FIELD_NAME, "deprecated_route_GET_/_test_cluster/deprecated_settings"), hasEntry("event.dataset", "deprecation.elasticsearch"), - hasEntry("log.level", "DEPRECATION"), + hasEntry("log.level", "CRITICAL"), hasKey("log.logger"), hasEntry("message", "[/_test_cluster/deprecated_settings] exists for deprecated tests") ) @@ -559,10 +648,9 @@ public class DeprecationHttpIT extends ESRestTestCase { return warnings; } - private HttpEntity buildSettingsRequest(List> settings, boolean useDeprecatedField) throws IOException { + private HttpEntity buildSettingsRequest(List> settings, String settingName) throws IOException { XContentBuilder builder = JsonXContent.contentBuilder(); - - builder.startObject().startArray(useDeprecatedField ? "deprecated_settings" : "settings"); + builder.startObject().startArray(settingName); for (Setting setting : settings) { builder.value(setting.getKey()); diff --git a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java b/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java index 12d212c4e760..81cbde5eb668 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java +++ b/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java @@ -67,7 +67,7 @@ public class TestDeprecatedQueryBuilder extends AbstractQueryBuilder source = parser.map(); - - if (source.containsKey("deprecated_settings")) { - deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "deprecated_settings", DEPRECATED_USAGE); - + if (parser.getRestApiVersion() == RestApiVersion.minimumSupported()) { + deprecationLogger.compatibleCritical("compatible_key", COMPATIBLE_API_USAGE); settings = (List) source.get("deprecated_settings"); + } else if (source.containsKey("deprecated_settings")) { + deprecationLogger.critical(DeprecationCategory.SETTINGS, "deprecated_settings", DEPRECATED_USAGE); + settings = (List) source.get("deprecated_settings"); + } else if (source.containsKey("deprecation_warning")) { + deprecationLogger.warn(DeprecationCategory.SETTINGS, "deprecated_warn_settings", DEPRECATED_WARN_USAGE); + settings = (List) source.get("deprecation_warning"); } else { settings = (List) source.get("settings"); } diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index fc44b3920027..bb0c3a043c62 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -90,7 +90,7 @@ public class RestGraphAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("type")) { - deprecationLogger.compatibleApiWarning("graph_with_types", TYPES_DEPRECATION_MESSAGE); + deprecationLogger.compatibleCritical("graph_with_types", TYPES_DEPRECATION_MESSAGE); request.param("type"); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java index 4db108a8cc35..e3138aa50de8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java @@ -76,7 +76,7 @@ public class RestGetTrainedModelsAction extends BaseRestHandler { Strings.EMPTY_ARRAY))); final GetTrainedModelsAction.Request request; if (restRequest.hasParam(INCLUDE_MODEL_DEFINITION)) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.API, INCLUDE_MODEL_DEFINITION, "[{}] parameter is deprecated! Use [include=definition] instead.", diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java index bb44c03729d2..f56a5899e1b3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/DomainSplitFunction.java @@ -157,7 +157,7 @@ public final class DomainSplitFunction { public static List domainSplit(String host, Map params) { // NOTE: we don't check SpecialPermission because this will be called (indirectly) from scripts AccessController.doPrivileged((PrivilegedAction) () -> { - deprecationLogger.deprecate(DeprecationCategory.API, "domainSplit", + deprecationLogger.critical(DeprecationCategory.API, "domainSplit", "Method [domainSplit] taking params is deprecated. Remove the params argument."); return null; }); diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java index c2b7c4b97ab8..0834b8da0e5a 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java @@ -122,7 +122,7 @@ public class TransportPutRollupJobAction extends AcknowledgedTransportMasterNode String timeZone = request.getConfig().getGroupConfig().getDateHistogram().getTimeZone(); String modernTZ = DateUtils.DEPRECATED_LONG_TIMEZONES.get(timeZone); if (modernTZ != null) { - deprecationLogger.deprecate( + deprecationLogger.critical( DeprecationCategory.PARSING, "deprecated_timezone", "Creating Rollup job [" diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java index 94cefa6f3742..5c1b913e174b 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java @@ -850,21 +850,21 @@ public class ApiKeyService { @Override public void logRenamedField(String parserName, Supplier location, String oldName, String currentName) { String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; - deprecationLogger.deprecate(DeprecationCategory.API, "api_key_field", + deprecationLogger.critical(DeprecationCategory.API, "api_key_field", "{}Deprecated field [{}] used in api key [{}], expected [{}] instead", prefix, oldName, apiKeyId, currentName); } @Override public void logReplacedField(String parserName, Supplier location, String oldName, String replacedName) { String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; - deprecationLogger.deprecate(DeprecationCategory.API, "api_key_field", + deprecationLogger.critical(DeprecationCategory.API, "api_key_field", "{}Deprecated field [{}] used in api key [{}], replaced by [{}]", prefix, oldName, apiKeyId, replacedName); } @Override public void logRemovedField(String parserName, Supplier location, String removedName) { String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] "; - deprecationLogger.deprecate(DeprecationCategory.API, "api_key_field", + deprecationLogger.critical(DeprecationCategory.API, "api_key_field", "{}Deprecated field [{}] used in api key [{}], which is unused and will be removed entirely", prefix, removedName, apiKeyId); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/Realms.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/Realms.java index 0b8e4650f988..53f167e807c0 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/Realms.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/Realms.java @@ -361,7 +361,7 @@ public class Realms implements Iterable { private void logDeprecationForReservedPrefixedRealmNames(List realmIdentifiers) { if (false == realmIdentifiers.isEmpty()) { - deprecationLogger.deprecate(DeprecationCategory.SECURITY, "realm_name_with_reserved_prefix", + deprecationLogger.critical(DeprecationCategory.SECURITY, "realm_name_with_reserved_prefix", "Found realm " + (realmIdentifiers.size() == 1 ? "name" : "names") + " with reserved prefix [{}]: [{}]. " + "In a future major release, node will fail to start if any realm names start with reserved prefix.", RealmSettings.RESERVED_REALM_NAME_PREFIX, diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealm.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealm.java index 2dea4b8b1f2c..bc1c84835909 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealm.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealm.java @@ -233,7 +233,7 @@ public class ReservedRealm extends CachingUsernamePasswordRealm { private void logDeprecatedUser(final User user){ Map metadata = user.metadata(); if (Boolean.TRUE.equals(metadata.get(MetadataUtils.DEPRECATED_METADATA_KEY))) { - deprecationLogger.deprecate(DeprecationCategory.SECURITY, "deprecated_user-" + user.principal(), "The user [" + + deprecationLogger.critical(DeprecationCategory.SECURITY, "deprecated_user-" + user.principal(), "The user [" + user.principal() + "] is deprecated and will be removed in a future version of Elasticsearch. " + metadata.get(MetadataUtils.DEPRECATED_REASON_METADATA_KEY)); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/ActiveDirectorySessionFactory.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/ActiveDirectorySessionFactory.java index c7cbf9189104..db4be15391d0 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/ActiveDirectorySessionFactory.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/ActiveDirectorySessionFactory.java @@ -528,7 +528,7 @@ class ActiveDirectorySessionFactory extends PoolingSessionFactory { super(config, timeout, ignoreReferralErrors, logger, groupsResolver, metadataResolver, domainDN, ActiveDirectorySessionFactorySettings.AD_UPN_USER_SEARCH_FILTER_SETTING, UPN_USER_FILTER, threadPool); if (userSearchFilter.contains("{0}")) { - deprecationLogger.deprecate(DeprecationCategory.SECURITY, "ldap_settings", + deprecationLogger.critical(DeprecationCategory.SECURITY, "ldap_settings", "The use of the account name variable {0} in the setting [" + RealmSettings.getFullSettingKey(config, ActiveDirectorySessionFactorySettings.AD_UPN_USER_SEARCH_FILTER_SETTING) + "] has been deprecated and will be removed in a future version!"); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/SessionFactory.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/SessionFactory.java index ff1b77f0f660..248acd98c533 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/SessionFactory.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/SessionFactory.java @@ -161,7 +161,7 @@ public abstract class SessionFactory { } else if (hostnameVerificationExists) { final String fullSettingKey = RealmSettings.getFullSettingKey(config, SessionFactorySettings.HOSTNAME_VERIFICATION_SETTING); final String deprecationKey = "deprecated_setting_" + fullSettingKey.replace('.', '_'); - DeprecationLogger.getLogger(logger.getName()).deprecate(DeprecationCategory.SETTINGS, deprecationKey, + DeprecationLogger.getLogger(logger.getName()).critical(DeprecationCategory.SETTINGS, deprecationKey, "the setting [{}] has been deprecated and will be removed in a future version. use [{}] instead", fullSettingKey, RealmSettings.getFullSettingKey(config, SSLConfigurationSettings.VERIFICATION_MODE_SETTING_REALM)); if (config.getSetting(SessionFactorySettings.HOSTNAME_VERIFICATION_SETTING)) { diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java index 223390fde074..1f199adde1c5 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java @@ -216,7 +216,7 @@ public class CompositeRolesStore { .forEach(rd -> { String reason = Objects.toString( rd.getMetadata().get(MetadataUtils.DEPRECATED_REASON_METADATA_KEY), "Please check the documentation"); - deprecationLogger.deprecate(DeprecationCategory.SECURITY, "deprecated_role-" + rd.getName(), "The role [" + rd.getName() + + deprecationLogger.critical(DeprecationCategory.SECURITY, "deprecated_role-" + rd.getName(), "The role [" + rd.getName() + "] is deprecated and will be removed in a future version of Elasticsearch. " + reason); }); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/DeprecationRoleDescriptorConsumer.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/DeprecationRoleDescriptorConsumer.java index a5888e0c5674..a631d9616081 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/DeprecationRoleDescriptorConsumer.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/DeprecationRoleDescriptorConsumer.java @@ -207,7 +207,7 @@ public final class DeprecationRoleDescriptorConsumer implements Consumer @Override public ShapeFieldMapper build(MapperBuilderContext context) { if (multiFieldsBuilder.hasMultiFields()) { - DEPRECATION_LOGGER.deprecate( + DEPRECATION_LOGGER.critical( DeprecationCategory.MAPPINGS, "shape_multifields", "Adding multifields to [shape] mappers has no effect and will be forbidden in future" diff --git a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapper.java b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapper.java index 41abc26a1767..c99d25f1668c 100644 --- a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapper.java +++ b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/mapper/SparseVectorFieldMapper.java @@ -66,7 +66,7 @@ public class SparseVectorFieldMapper extends FieldMapper { if (c.indexVersionCreated().onOrAfter(Version.V_8_0_0)) { throw new IllegalArgumentException(ERROR_MESSAGE); } else { - deprecationLogger.deprecate(DeprecationCategory.MAPPINGS, "sparse_vector", ERROR_MESSAGE_7X); + deprecationLogger.critical(DeprecationCategory.MAPPINGS, "sparse_vector", ERROR_MESSAGE_7X); return new Builder(n); } }); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index 4e0bc06067e0..6f18d2b98304 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -56,7 +56,7 @@ public class RestWatcherStatsAction extends BaseRestHandler { } if (metrics.contains("pending_watches")) { - deprecationLogger.deprecate(DeprecationCategory.API, "pending_watches", + deprecationLogger.critical(DeprecationCategory.API, "pending_watches", "The pending_watches parameter is deprecated, use queued_watches instead"); }