Change default level for deprecation logging (#80167)

This commit updates all deprecation message (except for REST
compatible API messages) in 8.0+ to be emit at warning level.
Currently none of these have been removed in future versions (yet) so they
should be logged at warning, not critical.

This commit also changes the default assertWarning to assert at warning level
and introduces a new assertCriticalWarning to assert critical warnings.
This commit is contained in:
Jake Landis 2021-11-04 12:35:27 -05:00 committed by GitHub
parent 4c6ab08a22
commit 255bf5056b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
146 changed files with 358 additions and 255 deletions

View File

@ -337,7 +337,7 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
assertThat(response.status(), equalTo(RestStatus.REQUEST_TIMEOUT));
assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED));
assertNoIndices(response);
assertWarnings(
assertCriticalWarnings(
"The HTTP status code for a cluster health timeout will be changed from 408 to 200 in a "
+ "future version. Set the [return_200_for_cluster_health_timeout] query parameter to [true] to suppress this message and "
+ "opt in to the future behaviour now."

View File

@ -817,7 +817,7 @@ public class ConstructingObjectParserTests extends ESTestCase {
);
StructRemovalField parse = StructRemovalField.PARSER.parse(parser, null);
assertWarnings("The field old_name has been removed and is being ignored");
assertCriticalWarnings("The field old_name has been removed and is being ignored");
}
}

View File

@ -7,6 +7,7 @@
*/
package org.elasticsearch.xcontent;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentParserUtils;
@ -233,7 +234,7 @@ public class ObjectParserTests extends ESTestCase {
assertEquals("foo", s.test);
assertWarnings(
false,
new DeprecationWarning(DeprecationLogger.CRITICAL, "[foo][1:15] Deprecated field [old_test] used, " + "expected [test] instead")
new DeprecationWarning(Level.WARN, "[foo][1:15] Deprecated field [old_test] used, " + "expected [test] instead")
);
}

View File

@ -154,15 +154,15 @@ public class ParseFieldTests extends ESTestCase {
assertTrue(field.match("new_name", LoggingDeprecationHandler.INSTANCE));
ensureNoWarnings();
assertTrue(field.match("old_name", LoggingDeprecationHandler.INSTANCE));
assertWarnings("Deprecated field [old_name] used, expected [new_name] instead");
assertCriticalWarnings("Deprecated field [old_name] used, expected [new_name] instead");
ParseField allDepField = new ParseField("dep", "old_name").withAllDeprecated()
.forRestApiVersion(RestApiVersion.equalTo(RestApiVersion.minimumSupported()));
assertTrue(allDepField.match("dep", LoggingDeprecationHandler.INSTANCE));
assertWarnings("Deprecated field [dep] used, this field is unused and will be removed entirely");
assertCriticalWarnings("Deprecated field [dep] used, this field is unused and will be removed entirely");
assertTrue(allDepField.match("old_name", LoggingDeprecationHandler.INSTANCE));
assertWarnings("Deprecated field [old_name] used, this field is unused and will be removed entirely");
assertCriticalWarnings("Deprecated field [old_name] used, this field is unused and will be removed entirely");
ParseField regularField = new ParseField("new_name");
assertTrue(regularField.match("new_name", LoggingDeprecationHandler.INSTANCE));

View File

@ -253,7 +253,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "Please change the filter name to [edge_ngram] instead."
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"edgeNGram_deprecation",
"The [edgeNGram] token filter name is deprecated and will be removed in a future version. "
@ -294,7 +294,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "Please change the filter name to [ngram] instead."
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_deprecation",
"The [nGram] token filter name is deprecated and will be removed in a future version. "
@ -357,7 +357,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "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.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. "
@ -374,7 +374,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "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.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"edgeNGram_tokenizer_deprecation",
"The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. "
@ -612,7 +612,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "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.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. "
@ -628,7 +628,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
+ "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.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"edgeNGram_tokenizer_deprecation",
"The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. "

View File

@ -46,7 +46,7 @@ public class SynonymTokenFilterFactory extends AbstractTokenFilterFactory {
this.settings = settings;
if (settings.get("ignore_case") != null) {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.ANALYSIS,
"synonym_ignore_case_option",
"The ignore_case option on the synonym_graph filter is deprecated. "

View File

@ -409,7 +409,7 @@ public final class GeoIpProcessor extends AbstractProcessor {
// noop, should be removed in 9.0
Object value = config.remove("fallback_to_default_databases");
if (value != null) {
DEPRECATION_LOGGER.critical(DeprecationCategory.OTHER, "default_databases_message", DEFAULT_DATABASES_DEPRECATION_MESSAGE);
DEPRECATION_LOGGER.warn(DeprecationCategory.OTHER, "default_databases_message", DEFAULT_DATABASES_DEPRECATION_MESSAGE);
}
DatabaseReaderLazyLoader lazyLoader = databaseNodeService.getDatabase(databaseFile);

View File

@ -205,7 +205,7 @@ public class UserAgentProcessor extends AbstractProcessor {
boolean ignoreMissing = readBooleanProperty(TYPE, processorTag, config, "ignore_missing", false);
Object ecsValue = config.remove("ecs");
if (ecsValue != null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"ingest_useragent_ecs_settings",
"setting [ecs] is deprecated as ECS format is the default and only option"

View File

@ -43,7 +43,7 @@ public class RestMultiSearchTemplateActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/some_type/_msearch/template").withContent(bytesContent, null).build();
dispatchRequest(request);
assertWarnings(RestMultiSearchTemplateAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiSearchTemplateAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeInBody() {
@ -55,6 +55,6 @@ public class RestMultiSearchTemplateActionTests extends RestActionTestCase {
).withPath("/some_index/_msearch/template").withContent(bytesContent, null).build();
dispatchRequest(request);
assertWarnings(RestMultiSearchTemplateAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiSearchTemplateAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -37,7 +37,7 @@ public class RestSearchTemplateActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/some_type/_search/template").build();
dispatchRequest(request);
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeParameter() {
@ -49,6 +49,6 @@ public class RestSearchTemplateActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/_search/template").withParams(params).build();
dispatchRequest(request);
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -396,7 +396,7 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
XContentParser parser = createParserWithCompatibilityFor(JsonXContent.jsonXContent, queryAsString, RestApiVersion.V_7);
QueryBuilder queryBuilder = parseQuery(parser);
queryBuilder.toQuery(searchExecutionContext);
assertWarnings(PercolateQueryBuilder.DOCUMENT_TYPE_DEPRECATION_MESSAGE);
assertCriticalWarnings(PercolateQueryBuilder.DOCUMENT_TYPE_DEPRECATION_MESSAGE);
}
public void testFromJsonWithType() throws IOException {
@ -416,6 +416,6 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
XContentParser parser = createParserWithCompatibilityFor(JsonXContent.jsonXContent, queryAsString, RestApiVersion.V_7);
QueryBuilder queryBuilder = parseQuery(parser);
rewriteAndFetch(queryBuilder, searchExecutionContext).toQuery(searchExecutionContext);
assertWarnings(PercolateQueryBuilder.TYPE_DEPRECATION_MESSAGE);
assertCriticalWarnings(PercolateQueryBuilder.TYPE_DEPRECATION_MESSAGE);
}
}

View File

@ -52,7 +52,7 @@ public class ReindexSslConfig {
static {
Setting.Property[] defaultProperties = new Setting.Property[] { Setting.Property.NodeScope, Setting.Property.Filtered };
Setting.Property[] deprecatedProperties = new Setting.Property[] {
Setting.Property.Deprecated,
Setting.Property.DeprecatedWarning,
Setting.Property.NodeScope,
Setting.Property.Filtered };
for (String key : SslConfigurationKeys.getStringKeys()) {

View File

@ -68,7 +68,7 @@ public class ReindexValidator {
);
SearchSourceBuilder searchSource = request.getSearchRequest().source();
if (searchSource != null && searchSource.sorts() != null && searchSource.sorts().isEmpty() == false) {
deprecationLogger.critical(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE);
deprecationLogger.warn(DeprecationCategory.API, "reindex_sort", SORT_DEPRECATED_MESSAGE);
}
}

View File

@ -45,7 +45,7 @@ public class RestDeleteByQueryActionTests extends RestActionTestCase {
// RestDeleteByQueryAction itself doesn't check for a deprecated type usage
// checking here for a deprecation from its internal search request
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -45,6 +45,6 @@ public class RestUpdateByQueryActionTests extends RestActionTestCase {
// RestUpdateByQueryAction itself doesn't check for a deprecated type usage
// checking here for a deprecation from its internal search request
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -38,7 +38,7 @@ public class AzureDiscoveryPlugin extends Plugin implements DiscoveryPlugin {
public AzureDiscoveryPlugin(Settings settings) {
this.settings = settings;
deprecationLogger.critical(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated.");
deprecationLogger.warn(DeprecationCategory.PLUGINS, "azure_discovery_plugin", "azure classic discovery plugin is deprecated.");
logger.trace("starting azure classic discovery plugin...");
}

View File

@ -151,7 +151,7 @@ final class Ec2ClientSettings {
return null;
} else {
if (key.length() == 0) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"ec2_invalid_settings",
"Setting [{}] is set but [{}] is not, which will be unsupported in future",
@ -160,7 +160,7 @@ final class Ec2ClientSettings {
);
}
if (secret.length() == 0) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"ec2_invalid_settings",
"Setting [{}] is set but [{}] is not, which will be unsupported in future",

View File

@ -15,7 +15,7 @@ import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.BasicSessionCredentials;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.settings.MockSecureSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
@ -73,7 +73,7 @@ public class AwsEc2ServiceImplTests extends ESTestCase {
assertSettingDeprecationsAndWarnings(
new Setting<?>[] {},
new DeprecationWarning(
DeprecationLogger.CRITICAL,
Level.WARN,
"Setting [discovery.ec2.access_key] is set but " + "[discovery.ec2.secret_key] is not, which will be unsupported in future"
)
);
@ -91,7 +91,7 @@ public class AwsEc2ServiceImplTests extends ESTestCase {
assertSettingDeprecationsAndWarnings(
new Setting<?>[] {},
new DeprecationWarning(
DeprecationLogger.CRITICAL,
Level.WARN,
"Setting [discovery.ec2.secret_key] is set but " + "[discovery.ec2.access_key] is not, which will be unsupported in future"
)
);

View File

@ -55,7 +55,7 @@ public class AzureRepository extends MeteredBlobStoreRepository {
"default",
Function.identity(),
Property.NodeScope,
Property.Deprecated
Property.DeprecatedWarning
);
public static final Setting<String> CLIENT_NAME = new Setting<>("client", ACCOUNT_SETTING, Function.identity());
public static final Setting<String> CONTAINER_SETTING = new Setting<>(

View File

@ -87,7 +87,7 @@ public class GoogleCloudStorageClientSettings {
static final Setting.AffixSetting<String> APPLICATION_NAME_SETTING = Setting.affixKeySetting(
PREFIX,
"application_name",
key -> new Setting<>(key, "repository-gcs", Function.identity(), Setting.Property.NodeScope, Setting.Property.Deprecated)
key -> new Setting<>(key, "repository-gcs", Function.identity(), Setting.Property.NodeScope, Setting.Property.DeprecatedWarning)
);
/** The credentials used by the client to connect to the Storage endpoint. */

View File

@ -142,7 +142,7 @@ public class JsonLoggerTests extends ESTestCase {
);
}
assertWarnings("deprecated message1");
assertCriticalWarnings("deprecated message1");
}
public void testCompatibleLog() throws Exception {
@ -201,7 +201,7 @@ public class JsonLoggerTests extends ESTestCase {
);
}
assertWarnings("deprecated message1", "compatible API message");
assertCriticalWarnings("deprecated message1", "compatible API message");
});
}
@ -234,7 +234,7 @@ public class JsonLoggerTests extends ESTestCase {
contains(
// deprecation log for field deprecated_name
allOf(
hasEntry("log.level", "CRITICAL"),
hasEntry("log.level", "WARN"),
hasEntry("event.dataset", "deprecation.elasticsearch"),
hasEntry("data_stream.dataset", "deprecation.elasticsearch"),
hasEntry("data_stream.namespace", "default"),
@ -251,7 +251,7 @@ public class JsonLoggerTests extends ESTestCase {
),
// deprecation log for field deprecated_name2 (note it is not being throttled)
allOf(
hasEntry("log.level", "CRITICAL"),
hasEntry("log.level", "WARN"),
hasEntry("event.dataset", "deprecation.elasticsearch"),
hasEntry("data_stream.dataset", "deprecation.elasticsearch"),
hasEntry("data_stream.namespace", "default"),
@ -288,9 +288,13 @@ public class JsonLoggerTests extends ESTestCase {
}
assertWarnings(
"Deprecated field [deprecated_name] used, expected [new_name] instead",
"Deprecated field [deprecated_name2] used, expected [new_name] instead",
"Deprecated field [compatible_deprecated_name] used, expected [new_name] instead"
true,
new DeprecationWarning(Level.WARN, "Deprecated field [deprecated_name] used, expected [new_name] instead"),
new DeprecationWarning(Level.WARN, "Deprecated field [deprecated_name2] used, expected [new_name] instead"),
new DeprecationWarning(
DeprecationLogger.CRITICAL,
"Deprecated field [compatible_deprecated_name] used, expected [new_name] instead"
)
);
});
}
@ -300,7 +304,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.critical(DeprecationCategory.OTHER, "someKey", "deprecated message1");
testLogger.warn(DeprecationCategory.OTHER, "someKey", "deprecated message1");
final Path path = PathUtils.get(
System.getProperty("es.logs.base_path"),
@ -315,7 +319,7 @@ public class JsonLoggerTests extends ESTestCase {
contains(
allOf(
hasEntry("event.dataset", "deprecation.elasticsearch"),
hasEntry("log.level", "CRITICAL"),
hasEntry("log.level", "WARN"),
hasEntry("log.logger", "org.elasticsearch.deprecation.test"),
hasEntry("elasticsearch.cluster.name", "elasticsearch"),
hasEntry("elasticsearch.node.name", "sample-name"),
@ -551,7 +555,7 @@ public class JsonLoggerTests extends ESTestCase {
threadContext.putHeader(Task.X_OPAQUE_ID, "ID1");
deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message2");
assertWarnings("message1", "message2");
assertCriticalWarnings("message1", "message2");
final Path path = PathUtils.get(
System.getProperty("es.logs.base_path"),
@ -584,7 +588,7 @@ public class JsonLoggerTests extends ESTestCase {
threadContext.putHeader(Task.X_OPAQUE_ID, "ID2");
deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message1");
deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message2");
assertWarnings("message1", "message2");
assertCriticalWarnings("message1", "message2");
final Path path = PathUtils.get(
System.getProperty("es.logs.base_path"),

View File

@ -8,13 +8,13 @@
package org.elasticsearch.snapshots;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.indices.AssociatedIndexDescriptor;
@ -364,7 +364,7 @@ public class SystemIndicesSnapshotIT extends AbstractSnapshotIntegTestCase {
new MockLogAppender.SeenEventExpectation(
"restore-system-index-from-snapshot",
"org.elasticsearch.deprecation.snapshots.RestoreService",
DeprecationLogger.CRITICAL,
Level.WARN,
"Restoring system indices by name is deprecated. Use feature states instead. System indices: [.test-system-idx]"
)
);

View File

@ -184,7 +184,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
}
});
if (systemIndicesNames.isEmpty() == false) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"open_system_index_access",
"this request accesses system indices: {}, but in a future major version, direct access to system "
@ -228,7 +228,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction<Get
}
if (systemAliases.isEmpty() == false) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"open_system_alias_access",
"this request accesses aliases with names reserved for system indices: {}, but in a future major version, direct "

View File

@ -888,7 +888,7 @@ public class TransportSearchAction extends HandledTransportAction<SearchRequest,
}
}
if (frozenIndices != null) {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.INDICES,
"search-frozen-indices",
FROZEN_INDICES_DEPRECATION_MESSAGE,

View File

@ -26,7 +26,7 @@ public final class BootstrapSettings {
public static final Setting<Boolean> SYSTEM_CALL_FILTER_SETTING = Setting.boolSetting(
"bootstrap.system_call_filter",
true,
Property.Deprecated,
Property.DeprecatedWarning,
Property.NodeScope
);
public static final Setting<Boolean> CTRLHANDLER_SETTING = Setting.boolSetting("bootstrap.ctrlhandler", true, Property.NodeScope);

View File

@ -344,7 +344,7 @@ public class IndexMetadata implements Diffable<IndexMetadata>, ToXContentFragmen
"",
Function.identity(),
Property.IndexScope,
Property.Deprecated
Property.DeprecatedWarning
);
public static final String INDEX_UUID_NA_VALUE = "_na_";

View File

@ -437,7 +437,7 @@ public class IndexNameExpressionResolver {
if (resolvedSystemIndices.isEmpty() == false) {
Collections.sort(resolvedSystemIndices);
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"open_system_index_access",
"this request accesses system indices: {}, but in a future major version, direct access to system "

View File

@ -206,7 +206,7 @@ public class MetadataCreateIndexService {
} else if (isHidden) {
logger.trace("index [{}] is a hidden index", index);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
"index_name_starts_with_dot",
"index name [{}] starts with a dot '.', in the next major version, index names "
@ -394,7 +394,7 @@ public class MetadataCreateIndexService {
);
if (v1Templates.size() > 1) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.TEMPLATES,
"index_template_multiple_match",
"index [{}] matches multiple legacy templates [{}], composable templates will only match a single template",
@ -1494,7 +1494,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.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"translog_retention",
"Translog retention settings [index.translog.retention.age] and [index.translog.retention.size] are deprecated and "
@ -1506,7 +1506,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.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"store_type_setting",
"[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. "

View File

@ -55,7 +55,7 @@ public class DataTier {
true,
Property.Dynamic,
Property.NodeScope,
Property.Deprecated
Property.DeprecatedWarning
);
public static final String TIER_PREFERENCE = "index.routing.allocation.include._tier_preference";

View File

@ -83,7 +83,7 @@ public class DiskThresholdDecider extends AllocationDecider {
}
},
Setting.Property.NodeScope,
Setting.Property.Deprecated
Setting.Property.DeprecatedWarning
);
public static final Setting<Boolean> SETTING_IGNORE_DISK_WATERMARKS = Setting.boolSetting(

View File

@ -22,7 +22,11 @@ import java.util.Set;
*/
public abstract class SecureSetting<T> extends Setting<T> {
private static final Set<Property> ALLOWED_PROPERTIES = EnumSet.of(Property.Deprecated, Property.Consistent);
private static final Set<Property> ALLOWED_PROPERTIES = EnumSet.of(
Property.Deprecated,
Property.DeprecatedWarning,
Property.Consistent
);
private static final Property[] FIXED_PROPERTIES = { Property.NodeScope };

View File

@ -167,7 +167,7 @@ public class DateUtils {
public static ZoneId of(String zoneId) {
String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId);
if (deprecatedId != null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.PARSING,
"timezone",
"Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead"

View File

@ -282,7 +282,7 @@ public class ByteSizeValue implements Writeable, Comparable<ByteSizeValue>, ToXC
} catch (final NumberFormatException e) {
try {
final double doubleValue = Double.parseDouble(s);
DeprecationLoggerHolder.deprecationLogger.critical(
DeprecationLoggerHolder.deprecationLogger.warn(
DeprecationCategory.PARSING,
"fractional_byte_values",
"Fractional bytes values are deprecated. Use non-fractional bytes values instead: [{}] found for setting [{}]",

View File

@ -50,14 +50,14 @@ public class PageCacheRecycler {
1d,
0d,
Property.NodeScope,
Property.Deprecated
Property.DeprecatedWarning
);
public static final Setting<Double> WEIGHT_INT_SETTING = Setting.doubleSetting(
"cache.recycler.page.weight.ints",
1d,
0d,
Property.NodeScope,
Property.Deprecated
Property.DeprecatedWarning
);
// object pages are less useful to us so we give them a lower weight by default
public static final Setting<Double> WEIGHT_OBJECTS_SETTING = Setting.doubleSetting(

View File

@ -39,7 +39,7 @@ public class LoggingDeprecationHandler implements DeprecationHandler {
public static final LoggingDeprecationHandler INSTANCE = new LoggingDeprecationHandler();
private TriConsumer<String, Object[], String> deprecationLoggerFunction = (message, params, field_name) -> deprecationLogger.critical(
private TriConsumer<String, Object[], String> deprecationLoggerFunction = (message, params, field_name) -> deprecationLogger.warn(
DeprecationCategory.API,
"deprecated_field_" + field_name,
message,

View File

@ -204,7 +204,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.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"index-sort-aliases",
"Index sort for index ["

View File

@ -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.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.ANALYSIS,
"analyzer.version",
"Setting [version] on analysis component [" + name + "] has no effect and is deprecated"

View File

@ -46,7 +46,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
+ "] index level setting."
);
} else {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.ANALYSIS,
"excessive_shingle_diff",
"Deprecated big difference between maxShingleSize and minShingleSize"
@ -81,7 +81,7 @@ public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException("Token filter [" + name() + "] cannot be used to parse synonyms");
} else {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.ANALYSIS,
"synonym_tokenfilters",
"Token filter " + name() + "] will not be usable to parse synonym after v7.0"

View File

@ -209,7 +209,7 @@ public class CompletionFieldMapper extends FieldMapper {
"Limit of completion field contexts [" + COMPLETION_CONTEXTS_LIMIT + "] has been exceeded"
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"excessive_completion_contexts",
"You have defined more than ["

View File

@ -307,7 +307,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.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"date_mapper_null_field",
"Error parsing ["

View File

@ -1287,7 +1287,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
}
if (Objects.equals("boost", propName)) {
if (parserContext.indexVersionCreated().before(Version.V_8_0_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"boost",
"Parameter [boost] on field [{}] is deprecated and has no effect",
@ -1301,7 +1301,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
}
Parameter<?> parameter = deprecatedParamsMap.get(propName);
if (parameter != null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
propName,
"Parameter [{}] on mapper [{}] is deprecated, use [{}]",
@ -1314,7 +1314,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
}
if (parameter == null) {
if (isDeprecatedParameter(propName, parserContext.indexVersionCreated())) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
propName,
"Parameter [{}] has no effect on type [{}] and will be removed in future",
@ -1327,7 +1327,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.critical(
deprecationLogger.warn(
DeprecationCategory.API,
propName,
"Parameter [{}] is used in a dynamic template mapping and has no effect on type [{}]. "
@ -1343,7 +1343,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
);
}
if (parameter.deprecated) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
propName,
"Parameter [{}] is deprecated and will be removed in a future version",

View File

@ -92,7 +92,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
+ "removed. Please remove it from your mappings and templates."
);
} else {
deprecationLogger.critical(DeprecationCategory.TEMPLATES, "field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE);
deprecationLogger.warn(DeprecationCategory.TEMPLATES, "field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE);
}
}
return new FieldNamesFieldMapper(enabled.getValue(), indexVersionCreated);
@ -145,7 +145,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
if (isEnabled() == false) {
throw new IllegalStateException("Cannot run [exists] queries if the [_field_names] field is disabled");
}
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"terms_query_on_field_names",
"terms query on the _field_names field is deprecated and will be removed, use exists query instead"

View File

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

View File

@ -156,7 +156,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
return new IndexFieldData.Builder() {
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
deprecationLogger.critical(DeprecationCategory.AGGREGATIONS, "id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE);
deprecationLogger.warn(DeprecationCategory.AGGREGATIONS, "id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE);
final IndexFieldData<?> fieldData = fieldDataBuilder.build(cache, breakerService);
return new IndexFieldData<>() {
@Override

View File

@ -124,7 +124,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.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"ip_mapper_null_field",
"Error parsing ["

View File

@ -160,7 +160,7 @@ public class ObjectMapper extends Mapper implements Cloneable {
}
return true;
} else if (fieldName.equals("include_in_all")) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"include_in_all",
"[include_in_all] is deprecated, the _all field have been removed in this version"

View File

@ -459,7 +459,7 @@ public class RootObjectMapper extends ObjectMapper {
if (failInvalidDynamicTemplates) {
throw new IllegalArgumentException(message, lastError);
} else {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.TEMPLATES,
"invalid_dynamic_template",
"{}, last error: [{}]",

View File

@ -106,7 +106,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.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
"multifield_within_multifield",
"At least one multi-field, ["

View File

@ -146,7 +146,7 @@ public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder<RandomScore
} else {
String fieldName;
if (field == null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.QUERIES,
"seed_requires_field",
"As of version 7.0 Elasticsearch will require that a [field] parameter is provided when a [seed] is set"

View File

@ -105,7 +105,7 @@ final class SimilarityProviders {
"Basic model [" + basicModel + "] isn't supported anymore, " + "please use another model."
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
basicModel + "_similarity_model_replaced",
"Basic model ["
@ -144,7 +144,7 @@ final class SimilarityProviders {
"After effect [" + afterEffect + "] isn't supported anymore, please use another effect."
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
afterEffect + "_after_effect_replaced",
"After effect ["
@ -242,7 +242,7 @@ final class SimilarityProviders {
if (version.onOrAfter(Version.V_7_0_0)) {
throw new IllegalArgumentException("Unknown settings for similarity of type [" + type + "]: " + unknownSettings);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
"unknown_similarity_setting",
"Unknown settings for similarity of type [" + type + "]: " + unknownSettings

View File

@ -114,7 +114,7 @@ public final class SimilarityService {
? providers.get("default").get()
: providers.get(SimilarityService.DEFAULT_SIMILARITY).get();
if (providers.get("base") != null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.QUERIES,
"base_similarity_ignored",
"The [base] similarity is ignored since query normalization and coords have been removed"

View File

@ -127,7 +127,7 @@ public final class AnalysisModule {
@Override
public TokenFilterFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
if (indexSettings.getIndexVersionCreated().before(Version.V_7_0_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"standard_deprecation",
"The [standard] token filter name is deprecated and will be removed in a future version."
@ -196,7 +196,7 @@ public final class AnalysisModule {
// in certain circumstances to create a new index referencing the standard token filter
// until version 7_5_2
if (version.before(Version.V_7_6_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"standard_deprecation",
"The [standard] token filter is deprecated and will be removed in a future version."

View File

@ -37,7 +37,7 @@ public class ConditionalProcessor extends AbstractProcessor implements WrappingP
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> FUNCTIONS = Map.of("_type", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.INDICES,
"conditional-processor__type",
"[types removal] Looking up doc types [_type] in scripts is deprecated."

View File

@ -321,7 +321,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.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"no-jdk",
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release"

View File

@ -216,7 +216,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
public static final Setting<Boolean> CACHE_REPOSITORY_DATA = Setting.boolSetting(
"cache_repository_data",
true,
Setting.Property.Deprecated
Setting.Property.DeprecatedWarning
);
/**

View File

@ -65,7 +65,7 @@ public class DeprecationRestHandler implements RestHandler {
@Override
public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
if (compatibleVersionWarning == false) {
deprecationLogger.critical(DeprecationCategory.API, deprecationKey, deprecationMessage);
deprecationLogger.warn(DeprecationCategory.API, deprecationKey, deprecationMessage);
} else {
deprecationLogger.compatibleCritical(deprecationKey, deprecationMessage);
}

View File

@ -47,7 +47,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.critical(
deprecationLogger.warn(
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 "

View File

@ -23,14 +23,14 @@ abstract class AbstractSortScript extends DocBasedScript implements ScorerAware
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
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.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"sort-script__doc",
"Accessing variable [doc] via [params._doc] from within an sort-script " + "is deprecated in favor of directly accessing [doc]."

View File

@ -29,7 +29,7 @@ public abstract class AggregationScript extends DocBasedScript implements Scorer
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"aggregation-script_doc",
"Accessing variable [doc] via [params.doc] from within an aggregation-script "
@ -37,7 +37,7 @@ public abstract class AggregationScript extends DocBasedScript implements Scorer
);
return value;
}, "_doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"aggregation-script__doc",
"Accessing variable [doc] via [params._doc] from within an aggregation-script "

View File

@ -28,14 +28,14 @@ public abstract class FieldScript extends DocBasedScript {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
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.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"field-script__doc",
"Accessing variable [doc] via [params._doc] from within an field-script "

View File

@ -52,14 +52,14 @@ public abstract class ScoreScript extends DocBasedScript {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
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.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"score-script__doc",
"Accessing variable [doc] via [params._doc] from within an score-script "

View File

@ -108,7 +108,14 @@ public class ScriptService implements Closeable, ClusterStateApplier, ScriptComp
public static final Setting.AffixSetting<Integer> SCRIPT_CACHE_SIZE_SETTING = Setting.affixKeySetting(
CONTEXT_PREFIX,
"cache_max_size",
key -> Setting.intSetting(key, SCRIPT_GENERAL_CACHE_SIZE_SETTING, 0, Property.NodeScope, Property.Dynamic, Property.Deprecated)
key -> Setting.intSetting(
key,
SCRIPT_GENERAL_CACHE_SIZE_SETTING,
0,
Property.NodeScope,
Property.Dynamic,
Property.DeprecatedWarning
)
);
public static final Setting.AffixSetting<TimeValue> SCRIPT_CACHE_EXPIRE_SETTING = Setting.affixKeySetting(
@ -120,7 +127,7 @@ public class ScriptService implements Closeable, ClusterStateApplier, ScriptComp
TimeValue.timeValueMillis(0),
Property.NodeScope,
Property.Dynamic,
Property.Deprecated
Property.DeprecatedWarning
)
);
@ -138,7 +145,7 @@ public class ScriptService implements Closeable, ClusterStateApplier, ScriptComp
: new ScriptCache.CompilationRate(value),
Property.NodeScope,
Property.Dynamic,
Property.Deprecated
Property.DeprecatedWarning
)
);

View File

@ -56,7 +56,7 @@ public class ScriptedMetricAggContexts {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"map-script_doc",
"Accessing variable [doc] via [params.doc] from within an scripted metric agg map script "
@ -64,7 +64,7 @@ public class ScriptedMetricAggContexts {
);
return value;
}, "_doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"map-script__doc",
"Accessing variable [doc] via [params._doc] from within an scripted metric agg map script "
@ -72,7 +72,7 @@ public class ScriptedMetricAggContexts {
);
return value;
}, "_agg", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"map-script__agg",
"Accessing variable [_agg] via [params._agg] from within a scripted metric agg map script "

View File

@ -28,7 +28,7 @@ public abstract class TermsSetQueryScript {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = Map.of("doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"terms-set-query-script_doc",
"Accessing variable [doc] via [params.doc] from within an terms-set-query-script "
@ -36,7 +36,7 @@ public abstract class TermsSetQueryScript {
);
return value;
}, "_doc", value -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SCRIPTING,
"terms-set-query-script__doc",
"Accessing variable [doc] via [params._doc] from within an terms-set-query-script "

View File

@ -51,7 +51,7 @@ public final class AutoDateHistogramAggregatorFactory extends ValuesSourceAggreg
CardinalityUpperBound cardinality,
Map<String, Object> metadata) -> {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.AGGREGATIONS,
"auto-date-histogram-boolean",
"Running AutoIntervalDateHistogram aggregations on [boolean] fields is deprecated"

View File

@ -56,7 +56,7 @@ public final class DateHistogramAggregatorFactory extends ValuesSourceAggregator
parent,
cardinality,
metadata) -> {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.AGGREGATIONS,
"date-histogram-boolean",
"Running DateHistogram aggregations on [boolean] fields is deprecated"

View File

@ -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.critical(DeprecationCategory.AGGREGATIONS, "date-interval-getter", DEPRECATION_TEXT);
DEPRECATION_LOGGER.warn(DeprecationCategory.AGGREGATIONS, "date-interval-getter", DEPRECATION_TEXT);
if (interval instanceof Long) {
wrapper.fixedInterval(new DateHistogramInterval(interval + "ms"));
} else {

View File

@ -71,7 +71,7 @@ public class DateRangeAggregationBuilder extends AbstractRangeBuilder<DateRangeA
Aggregator parent,
CardinalityUpperBound cardinality,
Map<String, Object> metadata) -> {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.AGGREGATIONS,
"Range-boolean",
"Running Range or DateRange aggregations on [boolean] fields is deprecated"

View File

@ -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.critical(
deprecationLogger.warn(
DeprecationCategory.AGGREGATIONS,
"global_ordinals_hash",
"global_ordinals_hash is deprecated. Please use [global_ordinals] instead."

View File

@ -282,7 +282,7 @@ public class GeoContextMapping extends ContextMapping<GeoQueryContext> {
MappedFieldType mappedFieldType = fieldResolver.apply(fieldName);
if (mappedFieldType == null) {
if (indexVersionCreated.before(Version.V_7_0_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"geo_context_mapping",
"field [{}] referenced in context [{}] is not defined in the mapping",
@ -298,7 +298,7 @@ public class GeoContextMapping extends ContextMapping<GeoQueryContext> {
}
} else if (GeoPointFieldMapper.CONTENT_TYPE.equals(mappedFieldType.typeName()) == false) {
if (indexVersionCreated.before(Version.V_7_0_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"geo_context_mapping",
"field [{}] referenced in context [{}] must be mapped to geo_point, found [{}]",

View File

@ -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.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"restore-system-index-from-snapshot",
"Restoring system indices by name is deprecated. Use feature states instead. System indices: "

View File

@ -96,7 +96,7 @@ public class TransportInfo implements ReportingService.Info {
if (InetAddresses.isInetAddress(hostString) == false) {
publishAddressString = hostString + '/' + publishAddress.toString();
if (cnameInPublishAddressProperty) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SETTINGS,
"cname_in_publish_address",
"es.transport.cname_in_publish_address system property is deprecated and no longer affects "

View File

@ -49,7 +49,7 @@ public class ClusterHealthResponsesTests extends AbstractSerializingTestCase<Clu
res.setTimedOut(randomBoolean());
if (res.isTimedOut()) {
assertEquals(RestStatus.REQUEST_TIMEOUT, res.status());
assertWarnings(ClusterHealthResponse.CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG);
assertCriticalWarnings(ClusterHealthResponse.CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG);
} else {
assertEquals(RestStatus.OK, res.status());
}

View File

@ -210,7 +210,7 @@ public class SettingsUpdaterTests extends ESTestCase {
"deprecated.setting",
Property.Dynamic,
Property.NodeScope,
Property.Deprecated
Property.DeprecatedWarning
);
final Settings settings = Settings.builder().put("deprecated.setting", "foo").build();
final Set<Setting<?>> settingsSet = Stream.concat(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.stream(), Stream.of(deprecatedSetting))

View File

@ -107,7 +107,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"deprecated_token_filter_create",
"Using deprecated token filter [deprecated]"
@ -117,7 +117,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
@Override
public TokenStream normalize(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"deprecated_token_filter_normalize",
"Using deprecated token filter [deprecated]"

View File

@ -360,7 +360,7 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
assertThat(actualRequest.getPipeline().getDescription(), nullValue());
assertThat(actualRequest.getPipeline().getProcessors().size(), equalTo(numProcessors));
assertWarnings("[types removal] specifying _type in pipeline simulation requests is deprecated");
assertCriticalWarnings("[types removal] specifying _type in pipeline simulation requests is deprecated");
}
}

View File

@ -445,7 +445,7 @@ public class MultiSearchRequestTests extends ESTestCase {
assertThat(searchRequest.indices().length, equalTo(0));
assertThat(searchRequest.source().query(), instanceOf(MatchAllQueryBuilder.class));
}
assertWarnings(
assertCriticalWarnings(
"support for empty first line before any action metadata in msearch API is deprecated and will be removed "
+ "in the next major version"
);
@ -469,7 +469,7 @@ public class MultiSearchRequestTests extends ESTestCase {
assertThat(searchRequest.indices().length, equalTo(0));
assertThat(searchRequest.source().query(), instanceOf(MatchAllQueryBuilder.class));
}
assertWarnings(
assertCriticalWarnings(
"support for empty first line before any action metadata in msearch API is deprecated and will be removed "
+ "in the next major version"
);

View File

@ -696,7 +696,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
);
state = metadataIndexTemplateService.addIndexTemplateV2(state, false, "v2-template", v2Template);
assertWarnings(
assertCriticalWarnings(
"index template [v2-template] has index patterns [foo-bar-*, eggplant] matching patterns "
+ "from existing older templates [v1-template] with patterns (v1-template => [fo*, baz]); this template [v2-template] will "
+ "take precedence during new index creation"
@ -801,7 +801,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
req.patterns(Arrays.asList("*", "baz"));
state = MetadataIndexTemplateService.innerPutTemplate(state, req, IndexTemplateMetadata.builder("v1-template"));
assertWarnings(
assertCriticalWarnings(
"legacy template [v1-template] has index patterns [*, baz] matching patterns from existing "
+ "composable templates [v2-template] with patterns (v2-template => [foo-bar-*, eggplant]); this template "
+ "[v1-template] may be ignored in favor of a composable template at index creation time"
@ -872,7 +872,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
);
state = metadataIndexTemplateService.addIndexTemplateV2(state, false, "v2-template", v2Template);
assertWarnings(
assertCriticalWarnings(
"index template [v2-template] has index patterns [foo-bar-*, eggplant] matching patterns "
+ "from existing older templates [v1-template] with patterns (v1-template => [fo*, baz]); this template [v2-template] will "
+ "take precedence during new index creation"
@ -887,7 +887,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
req.patterns(Arrays.asList("fo*", "baz"));
state = MetadataIndexTemplateService.innerPutTemplate(state, req, IndexTemplateMetadata.builder("v1-template"));
assertWarnings(
assertCriticalWarnings(
"legacy template [v1-template] has index patterns [fo*, baz] matching patterns from existing "
+ "composable templates [v2-template] with patterns (v2-template => [foo-bar-*, eggplant]); this template "
+ "[v1-template] may be ignored in favor of a composable template at index creation time"
@ -921,7 +921,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
);
state = metadataIndexTemplateService.addIndexTemplateV2(state, false, "v2-template", v2Template);
assertWarnings(
assertCriticalWarnings(
"index template [v2-template] has index patterns [foo-bar-*, eggplant] matching patterns "
+ "from existing older templates [v1-template] with patterns (v1-template => [fo*, baz]); this template [v2-template] will "
+ "take precedence during new index creation"

View File

@ -651,7 +651,7 @@ public class SettingTests extends ESTestCase {
"foo.deprecated",
Collections.singletonList("foo.deprecated"),
Function.identity(),
Property.Deprecated,
Property.DeprecatedWarning,
Property.NodeScope
);
final Setting<List<String>> nonDeprecatedListSetting = Setting.listSetting(
@ -1379,7 +1379,11 @@ public class SettingTests extends ESTestCase {
undeprecatedSetting1.checkDeprecation(settings);
undeprecatedSetting2.checkDeprecation(settings);
ensureNoWarnings();
final Setting<String> criticalDeprecatedSetting = Setting.simpleString(criticalSettingName, settingValue, Property.Deprecated);
final Setting<String> criticalDeprecatedSetting = Setting.simpleString(
criticalSettingName,
settingValue,
Property.DeprecatedWarning
);
criticalDeprecatedSetting.checkDeprecation(settings);
assertSettingDeprecationsAndWarnings(new Setting<?>[] { criticalDeprecatedSetting });
final Setting<String> deprecatedSettingWarningOnly = Setting.simpleString(
@ -1398,7 +1402,7 @@ public class SettingTests extends ESTestCase {
final Settings settings = Settings.builder().put(settingName, settingValue).build();
setting.checkDeprecation(settings);
ensureNoWarnings();
final Setting<String> deprecatedSetting = Setting.simpleString(settingName, settingValue, Property.Deprecated);
final Setting<String> deprecatedSetting = Setting.simpleString(settingName, settingValue, Property.DeprecatedWarning);
deprecatedSetting.checkDeprecation(settings);
assertSettingDeprecationsAndWarnings(new Setting<?>[] { deprecatedSetting });
final Settings settingsWithSkipDeprecationSetting = Settings.builder()

View File

@ -352,7 +352,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
if (indexSettings.getIndexVersionCreated().equals(Version.CURRENT)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"deprecated_token_filter",
"Using deprecated token filter [deprecated]"
@ -384,11 +384,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(
DeprecationCategory.ANALYSIS,
"unused_token_filter",
"Using deprecated token filter [unused]"
);
deprecationLogger.warn(DeprecationCategory.ANALYSIS, "unused_token_filter", "Using deprecated token filter [unused]");
return tokenStream;
}
}
@ -401,7 +397,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"deprecated_normalizer",
"Using deprecated token filter [deprecated_normalizer]"

View File

@ -86,7 +86,7 @@ public class DeprecationRestHandlerTests extends ESTestCase {
if (compatibleVersionWarning) {
inOrder.verify(deprecationLogger).compatibleCritical("deprecated_route_GET_/some/path", deprecationMessage);
} else {
inOrder.verify(deprecationLogger).critical(DeprecationCategory.API, "deprecated_route_GET_/some/path", deprecationMessage);
inOrder.verify(deprecationLogger).warn(DeprecationCategory.API, "deprecated_route_GET_/some/path", deprecationMessage);
}
inOrder.verify(handler).handleRequest(request, channel, client);

View File

@ -112,7 +112,7 @@ public class RestCreateIndexActionTests extends ESTestCase {
.build();
action.prepareRequest(deprecatedRequest, mock(NodeClient.class));
assertWarnings(RestCreateIndexAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestCreateIndexAction.TYPES_DEPRECATION_MESSAGE);
RestRequest validRequest = new FakeRestRequest.Builder(xContentRegistry()).withMethod(RestRequest.Method.PUT)
.withPath("/some_index")
@ -149,6 +149,6 @@ public class RestCreateIndexActionTests extends ESTestCase {
CreateIndexRequest createIndexRequest = action.prepareRequestV7(request);
// some_type is replaced with _doc
assertThat(createIndexRequest.mappings(), equalTo("{\"_doc\":{\"properties\":{\"field1\":{\"type\":\"text\"}}}}"));
assertWarnings(RestCreateIndexAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestCreateIndexAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -38,7 +38,7 @@ public class RestGetIndicesActionTests extends ESTestCase {
RestGetIndicesAction handler = new RestGetIndicesAction();
handler.prepareRequest(request, mock(NodeClient.class));
assertWarnings(RestGetIndicesAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestGetIndicesAction.TYPES_DEPRECATION_MESSAGE);
// the same request without the parameter should pass without warning
request = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(

View File

@ -70,6 +70,6 @@ public class RestPutIndexTemplateActionTests extends ESTestCase {
.withContent(BytesReference.bytes(typedContent), null)
.build();
action.prepareRequest(request, mock(NodeClient.class));
assertWarnings(RestPutIndexTemplateAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestPutIndexTemplateAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -166,7 +166,7 @@ public class RestValidateQueryActionTests extends AbstractSearchTestCase {
.build();
performRequest(request);
assertWarnings(RestValidateQueryAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestValidateQueryAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeParameter() {
@ -181,7 +181,7 @@ public class RestValidateQueryActionTests extends AbstractSearchTestCase {
.build();
performRequest(request);
assertWarnings(RestValidateQueryAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestValidateQueryAction.TYPES_DEPRECATION_MESSAGE);
}
private void performRequest(RestRequest request) {

View File

@ -37,7 +37,7 @@ public class RestDeleteActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/some_id")
.build();
dispatchRequest(request);
assertWarnings(RestDeleteAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestDeleteAction.TYPES_DEPRECATION_MESSAGE);
RestRequest validRequest = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(Map.of("Accept", contentTypeHeader))
.withMethod(RestRequest.Method.DELETE)

View File

@ -45,6 +45,6 @@ public class RestGetActionTests extends RestActionTestCase {
Map.of("Content-Type", contentTypeHeader, "Accept", contentTypeHeader)
).withPath("/some_index/some_type/some_id");
dispatchRequest(deprecatedRequest.withMethod(method).build());
assertWarnings(RestGetAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestGetAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -99,7 +99,7 @@ public class RestGetSourceActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/id/_source")
.build();
dispatchRequest(request);
assertWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
}
}
@ -116,7 +116,7 @@ public class RestGetSourceActionTests extends RestActionTestCase {
.withParams(params)
.build();
dispatchRequest(request);
assertWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -100,7 +100,7 @@ public class RestIndexActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/some_id")
.build();
dispatchRequest(deprecatedRequest);
assertWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
}
public void testCreateWithTypeInPath() {
@ -110,7 +110,7 @@ public class RestIndexActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/some_id/_create")
.build();
dispatchRequest(deprecatedRequest);
assertWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
}
public void testAutoIdWithType() {
@ -120,6 +120,6 @@ public class RestIndexActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/")
.build();
dispatchRequest(deprecatedRequest);
assertWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -46,7 +46,7 @@ public class RestMultiGetActionTests extends RestActionTestCase {
Map.of("Content-Type", contentTypeHeader, "Accept", contentTypeHeader)
).withMethod(RestRequest.Method.GET).withPath("some_index/some_type/_mget").build();
dispatchRequest(deprecatedRequest);
assertWarnings(RestMultiGetAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiGetAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeInBody() throws Exception {
@ -70,7 +70,7 @@ public class RestMultiGetActionTests extends RestActionTestCase {
.withContent(BytesReference.bytes(content), null)
.build();
dispatchRequest(request);
assertWarnings(RestMultiGetAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiGetAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -42,7 +42,7 @@ public class RestMultiTermVectorsActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.POST).withPath("/some_index/some_type/_mtermvectors").build();
dispatchRequest(request);
assertWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeParameter() {
@ -54,7 +54,7 @@ public class RestMultiTermVectorsActionTests extends RestActionTestCase {
).withPath("/some_index/_mtermvectors").withParams(params).build();
dispatchRequest(request);
assertWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeInBody() throws IOException {
@ -77,6 +77,6 @@ public class RestMultiTermVectorsActionTests extends RestActionTestCase {
.build();
dispatchRequest(request);
assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -42,7 +42,7 @@ public class RestTermVectorsActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.POST).withPath("/some_index/some_type/some_id/_termvectors").build();
dispatchRequest(request);
assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeInBody() throws IOException {
@ -57,6 +57,6 @@ public class RestTermVectorsActionTests extends RestActionTestCase {
.build();
dispatchRequest(request);
assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -76,7 +76,7 @@ public class RestUpdateActionTests extends RestActionTestCase {
Map.of("Content-Type", contentTypeHeader, "Accept", contentTypeHeader)
).withMethod(RestRequest.Method.POST).withPath("/some_index/some_type/some_id/_update").build();
dispatchRequest(request);
assertWarnings(RestUpdateAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestUpdateAction.TYPES_DEPRECATION_MESSAGE);
RestRequest validRequest = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(
Map.of("Content-Type", contentTypeHeader, "Accept", contentTypeHeader)

View File

@ -45,7 +45,7 @@ public class RestCountActionTests extends RestActionTestCase {
.build();
dispatchRequest(request);
assertWarnings(RestCountAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestCountAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeParameter() {
@ -59,6 +59,6 @@ public class RestCountActionTests extends RestActionTestCase {
.build();
dispatchRequest(request);
assertWarnings(RestCountAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestCountAction.TYPES_DEPRECATION_MESSAGE);
}
}

View File

@ -38,7 +38,7 @@ public class RestExplainActionTests extends RestActionTestCase {
.withPath("/some_index/some_type/some_id/_explain")
.build();
dispatchRequest(deprecatedRequest);
assertWarnings(RestExplainAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestExplainAction.TYPES_DEPRECATION_MESSAGE);
RestRequest validRequest = new FakeRestRequest.Builder(xContentRegistry()).withHeaders(Map.of("Accept", contentTypeHeader))
.withMethod(RestRequest.Method.GET)

View File

@ -47,7 +47,7 @@ public class RestMultiSearchActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/some_type/_msearch").withContent(bytesContent, null).build();
dispatchRequest(request);
assertWarnings(RestMultiSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiSearchAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeInBody() {
@ -59,7 +59,7 @@ public class RestMultiSearchActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.POST).withPath("/some_index/_msearch").withContent(bytesContent, null).build();
dispatchRequest(request);
assertWarnings(RestMultiSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestMultiSearchAction.TYPES_DEPRECATION_MESSAGE);
}
private Map<String, List<String>> headersWith(String accept, List<String> value) {

View File

@ -39,7 +39,7 @@ public class RestSearchActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/some_type/_search").build();
dispatchRequest(request);
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
public void testTypeParameter() {
@ -51,7 +51,7 @@ public class RestSearchActionTests extends RestActionTestCase {
).withMethod(RestRequest.Method.GET).withPath("/some_index/_search").withParams(params).build();
dispatchRequest(request);
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
assertCriticalWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
/**

View File

@ -415,7 +415,7 @@ public class SearchSourceBuilderTests extends AbstractSearchTestCase {
assertEquals(2, searchSourceBuilder.indexBoosts().size());
assertEquals(new SearchSourceBuilder.IndexBoost("foo", 1.0f), searchSourceBuilder.indexBoosts().get(0));
assertEquals(new SearchSourceBuilder.IndexBoost("bar", 2.0f), searchSourceBuilder.indexBoosts().get(1));
assertWarnings("Object format in indices_boost is deprecated, please use array format instead");
assertCriticalWarnings("Object format in indices_boost is deprecated, please use array format instead");
}
}
@ -488,7 +488,7 @@ public class SearchSourceBuilderTests extends AbstractSearchTestCase {
SearchSourceBuilder searchSourceBuilder = SearchSourceBuilder.fromXContent(parser);
assertEquals(-1, searchSourceBuilder.size());
}
assertWarnings(
assertCriticalWarnings(
"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."
);

View File

@ -501,10 +501,24 @@ public abstract class ESTestCase extends LuceneTestCase {
/**
* Convenience method to assert warnings for settings deprecations and general deprecation warnings. All warnings passed to this method
* are assumed to be at DeprecationLogger.CRITICAL level.
* are assumed to be at WARNING level.
* @param expectedWarnings expected general deprecation warnings.
*/
protected final void assertWarnings(String... expectedWarnings) {
assertWarnings(
true,
Arrays.stream(expectedWarnings)
.map(expectedWarning -> new DeprecationWarning(Level.WARN, expectedWarning))
.toArray(DeprecationWarning[]::new)
);
}
/**
* Convenience method to assert warnings for settings deprecations and general deprecation warnings. All warnings passed to this method
* are assumed to be at CRITICAL level.
* @param expectedWarnings expected general deprecation warnings.
*/
protected final void assertCriticalWarnings(String... expectedWarnings) {
assertWarnings(
true,
Arrays.stream(expectedWarnings)

View File

@ -254,7 +254,7 @@ public class ESLoggerUsageTests extends ESTestCase {
public void checkDeprecationLogger() {
DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ESLoggerUsageTests.class);
deprecationLogger.critical(DeprecationCategory.OTHER, "key", "message {}", 123);
deprecationLogger.warn(DeprecationCategory.OTHER, "key", "message {}", 123);
}
}

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