[7.16] Drop non-setting deprecations down to warning level (#80374)

Complementary to #79665 this change
will reduce the deprecation logging level to WARN for (most) all non-settings that
continue to exist in 8.0+.
This commit is contained in:
Jake Landis 2021-11-10 13:07:56 -06:00 committed by GitHub
parent f736645266
commit 6358afb0cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 191 additions and 127 deletions

View file

@ -248,7 +248,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
filters.put("dutch_stem", DutchStemTokenFilterFactory::new);
filters.put("edge_ngram", EdgeNGramTokenFilterFactory::new);
filters.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"edgeNGram_deprecation",
"The [edgeNGram] token filter name is deprecated and will be removed in a future version. "
@ -276,7 +276,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
filters.put("multiplexer", MultiplexerTokenFilterFactory::new);
filters.put("ngram", NGramTokenFilterFactory::new);
filters.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_deprecation",
"The [nGram] token filter name is deprecated and will be removed in a future version. "
@ -330,7 +330,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
tokenizers.put("thai", ThaiTokenizerFactory::new);
tokenizers.put("nGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. "
@ -342,7 +342,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
tokenizers.put("ngram", NGramTokenizerFactory::new);
tokenizers.put("edgeNGram", (IndexSettings indexSettings, Environment environment, String name, Settings settings) -> {
if (indexSettings.getIndexVersionCreated().onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"edgeNGram_tokenizer_deprecation",
"The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. "
@ -645,7 +645,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
// Temporary shim for aliases. TODO deprecate after they are moved
tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("nGram", (version) -> {
if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"nGram_tokenizer_deprecation",
"The [nGram] tokenizer name is deprecated and will be removed in a future version. "
@ -656,7 +656,7 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
}));
tokenizers.add(PreConfiguredTokenizer.elasticsearchVersion("edgeNGram", (version) -> {
if (version.onOrAfter(org.elasticsearch.Version.V_7_6_0)) {
deprecationLogger.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

@ -8,6 +8,7 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.elasticsearch.Version;
@ -193,6 +194,7 @@ public class CommonAnalysisPluginTests extends ESTestCase {
createTestAnalysis(IndexSettingsModule.newIndexSettings("index", settings), settings, commonAnalysisPlugin);
assertWarnings(
Level.WARN,
"The [nGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [ngram] instead."
);
@ -214,6 +216,7 @@ public class CommonAnalysisPluginTests extends ESTestCase {
createTestAnalysis(IndexSettingsModule.newIndexSettings("index", settings), settings, commonAnalysisPlugin);
assertWarnings(
Level.WARN,
"The [edgeNGram] token filter name is deprecated and will be removed in a future version. "
+ "Please change the filter name to [edge_ngram] instead."
);
@ -276,6 +279,7 @@ public class CommonAnalysisPluginTests extends ESTestCase {
assertNotNull(tokenizer);
if (expectWarning) {
assertWarnings(
Level.WARN,
"The ["
+ deprecatedName
+ "] tokenizer name is deprecated and will be removed in a future version. "
@ -302,6 +306,7 @@ public class CommonAnalysisPluginTests extends ESTestCase {
if (expectWarning) {
assertWarnings(
Level.WARN,
"The ["
+ deprecatedName
+ "] tokenizer name is deprecated and will be removed in a future version. "

View file

@ -8,6 +8,7 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@ -57,7 +58,7 @@ public class CompoundAnalysisTests extends ESTestCase {
hasItems("donau", "dampf", "schiff", "donaudampfschiff", "spargel", "creme", "suppe", "spargelcremesuppe")
);
}
assertWarnings("Setting [version] on analysis component [custom7] has no effect and is deprecated");
assertWarnings(Level.WARN, "Setting [version] on analysis component [custom7] has no effect and is deprecated");
}
private List<String> analyze(Settings settings, String analyzerName, String text) throws IOException {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.ingest.common;
import org.apache.logging.log4j.Level;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
@ -84,6 +85,7 @@ public class BytesProcessorTests extends AbstractStringProcessorTestCase<Long> {
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue(fieldName, expectedResultType()), equalTo(1126L));
assertWarnings(
Level.WARN,
"Fractional bytes values are deprecated. Use non-fractional bytes values instead: [1.1kb] found for setting " + "[Ingest Field]"
);
}

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

@ -8,6 +8,7 @@
package org.elasticsearch.reindex;
import org.apache.logging.log4j.Level;
import org.elasticsearch.index.query.RangeQueryBuilder;
import org.elasticsearch.index.reindex.ReindexAction;
import org.elasticsearch.index.reindex.ReindexRequestBuilder;
@ -47,6 +48,6 @@ public class ReindexSingleNodeTests extends ESSingleNodeTestCase {
assertHitCount(client().prepareSearch("dest").setSize(0).get(), subsetSize);
assertHitCount(client().prepareSearch("dest").setQuery(new RangeQueryBuilder("foo").gte(0).lt(max - subsetSize)).get(), 0);
assertWarnings(ReindexValidator.SORT_DEPRECATED_MESSAGE);
assertWarnings(Level.WARN, ReindexValidator.SORT_DEPRECATED_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

@ -115,7 +115,7 @@ public class EvilLoggerTests extends ESTestCase {
}
for (int j = 0; j < iterations; j++) {
for (final Integer id : ids) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
Integer.toString(id),
"This is a maybe logged deprecation message" + id
@ -167,7 +167,7 @@ public class EvilLoggerTests extends ESTestCase {
for (int i = 0; i < 128; i++) {
assertLogLine(
deprecationEvents.get(i),
DeprecationLogger.CRITICAL,
Level.WARN,
"org.elasticsearch.common.logging.DeprecationLogger.logDeprecation",
"This is a maybe logged deprecation message" + i
);

View file

@ -227,7 +227,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

@ -899,7 +899,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

@ -220,7 +220,7 @@ public class MetadataCreateIndexService {
} else if (isHidden) {
logger.trace("index [{}] is a hidden index", index);
} else {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.INDICES,
"index_name_starts_with_dot",
"index name [{}] starts with a dot '.', in the next major version, index names "

View file

@ -193,7 +193,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

@ -292,7 +292,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

@ -217,7 +217,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

@ -73,7 +73,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 {
deprecationLogger.critical(
deprecationLogger.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

@ -205,7 +205,7 @@ public class CompletionFieldMapper extends FieldMapper {
private void checkCompletionContextsLimit() {
if (this.contexts.getValue() != null && this.contexts.getValue().size() > COMPLETION_CONTEXTS_LIMIT) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.MAPPINGS,
"excessive_completion_contexts",
"You have defined more than ["

View file

@ -311,7 +311,7 @@ public final class DateFieldMapper extends FieldMapper {
try {
return fieldType.parse(nullValue.getValue());
} catch (Exception e) {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"date_mapper_null_field",
"Error parsing ["

View file

@ -141,7 +141,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

@ -96,7 +96,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

@ -151,7 +151,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

@ -172,7 +172,7 @@ final class SimilarityProviders {
"After effect [" + afterEffect + "] isn't supported anymore, please use another effect."
);
} else {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.QUERIES,
afterEffect + "_after_effect_replaced",
"After effect ["

View file

@ -155,7 +155,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

@ -351,7 +351,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

@ -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 = org.elasticsearch.core.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 = org.elasticsearch.core.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 = org.elasticsearch.core.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 = org.elasticsearch.core.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

@ -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 = org.elasticsearch.core.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 = org.elasticsearch.core.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

@ -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

@ -7,6 +7,7 @@
*/
package org.elasticsearch.action.admin.indices;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.MockTokenFilter;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.TokenStream;
@ -108,7 +109,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"deprecated_token_filter_create",
"Using deprecated token filter [deprecated]"
@ -118,7 +119,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
@Override
public TokenStream normalize(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"deprecated_token_filter_normalize",
"Using deprecated token filter [deprecated]"
@ -574,7 +575,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
AnalyzeAction.Response analyze = TransportAnalyzeAction.analyze(req, registry, mockIndexService(), maxTokenCount);
assertEquals(2, analyze.getTokens().size());
assertWarnings("Using deprecated token filter [deprecated]");
assertWarnings(Level.WARN, "Using deprecated token filter [deprecated]");
// normalizer
req = new AnalyzeAction.Request();
@ -584,6 +585,6 @@ public class TransportAnalyzeActionTests extends ESTestCase {
analyze = TransportAnalyzeAction.analyze(req, registry, mockIndexService(), maxTokenCount);
assertEquals(1, analyze.getTokens().size());
assertWarnings("Using deprecated token filter [deprecated]");
assertWarnings(Level.WARN, "Using deprecated token filter [deprecated]");
}
}

View file

@ -269,6 +269,7 @@ public class TransportGetAliasesActionTests extends ESTestCase {
);
assertThat(result.size(), equalTo(0));
assertWarnings(
Level.WARN,
"this request accesses aliases with names reserved for system indices: [.y], but in a future major version, direct"
+ " access to system indices and their aliases will not be allowed"
);

View file

@ -686,6 +686,7 @@ public class MetadataCreateIndexServiceTests extends ESTestCase {
// Check deprecations
assertFalse(checkerService.validateDotIndex(".test2", false));
assertWarnings(
Level.WARN,
"index name [.test2] starts with a dot '.', in the next major version, index "
+ "names starting with a dot are reserved for hidden indices and system indices"
);

View file

@ -8,6 +8,7 @@
package org.elasticsearch.common.time;
import org.apache.logging.log4j.Level;
import org.elasticsearch.test.ESTestCase;
import org.joda.time.DateTimeZone;
@ -61,7 +62,7 @@ public class DateUtilsTests extends ESTestCase {
equalTo(jodaTz.getOffset(now))
);
if (DateUtils.DEPRECATED_SHORT_TIMEZONES.containsKey(jodaTz.getID())) {
assertWarnings("Use of short timezone id " + jodaId + " is deprecated. Use " + zoneId.getId() + " instead");
assertWarnings(Level.WARN, "Use of short timezone id " + jodaId + " is deprecated. Use " + zoneId.getId() + " instead");
}
// roundtrip does not throw either
assertNotNull(DateUtils.zoneIdToDateTimeZone(zoneId));

View file

@ -8,6 +8,7 @@
package org.elasticsearch.common.unit;
import org.apache.logging.log4j.Level;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.test.AbstractWireSerializingTestCase;
@ -322,6 +323,7 @@ public class ByteSizeValueTests extends AbstractWireSerializingTestCase<ByteSize
ByteSizeValue instance = ByteSizeValue.parseBytesSizeValue(fractionalValue, "test");
assertEquals(fractionalValue, instance.toString());
assertWarnings(
Level.WARN,
"Fractional bytes values are deprecated. Use non-fractional bytes values instead: ["
+ fractionalValue
+ "] found for setting [test]"

View file

@ -8,6 +8,7 @@
package org.elasticsearch.index;
import org.apache.logging.log4j.Level;
import org.apache.lucene.search.Query;
import org.elasticsearch.Version;
import org.elasticsearch.common.settings.Settings;
@ -184,6 +185,7 @@ public class IndexSortSettingsTests extends ESTestCase {
config.buildIndexSort(field -> mft, (ft, s) -> indexFieldDataService.getForField(ft, "index", s));
assertWarnings(
Level.WARN,
"Index sort for index [test] defined on field [field] which resolves to field [aliased]. "
+ "You will not be able to define an index sort over aliased fields in new indexes"
);

View file

@ -10,6 +10,7 @@ package org.elasticsearch.index.analysis;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockTokenFilter;
import org.apache.lucene.analysis.TokenStream;
@ -353,7 +354,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
if (indexSettings.getIndexVersionCreated().equals(Version.CURRENT)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"deprecated_token_filter",
"Using deprecated token filter [deprecated]"
@ -385,7 +386,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(DeprecationCategory.OTHER, "unused_token_filter", "Using deprecated token filter [unused]");
deprecationLogger.warn(DeprecationCategory.OTHER, "unused_token_filter", "Using deprecated token filter [unused]");
return tokenStream;
}
}
@ -398,7 +399,7 @@ public class AnalysisRegistryTests extends ESTestCase {
@Override
public TokenStream create(TokenStream tokenStream) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"deprecated_normalizer",
"Using deprecated token filter [deprecated_normalizer]"
@ -432,7 +433,7 @@ public class AnalysisRegistryTests extends ESTestCase {
new AnalysisModule(TestEnvironment.newEnvironment(settings), singletonList(plugin)).getAnalysisRegistry().build(idxSettings);
// We should only get a warning from the token filter that is referenced in settings
assertWarnings("Using deprecated token filter [deprecated]");
assertWarnings(Level.WARN, "Using deprecated token filter [deprecated]");
indexSettings = Settings.builder()
.put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.getPreviousVersion())
@ -450,7 +451,7 @@ public class AnalysisRegistryTests extends ESTestCase {
// We should only get a warning from the normalizer, because we're on a version where 'deprecated'
// works fine
assertWarnings("Using deprecated token filter [deprecated_normalizer]");
assertWarnings(Level.WARN, "Using deprecated token filter [deprecated_normalizer]");
indexSettings = Settings.builder()
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)

View file

@ -7,6 +7,7 @@
*/
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.SimpleAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@ -763,6 +764,7 @@ public class CompletionFieldMapperTests extends MapperTestCase {
b.endArray();
}));
assertWarnings(
Level.WARN,
"You have defined more than [10] completion contexts in the mapping for field [field]. "
+ "The maximum allowed number of completion contexts in a mapping will be limited to [10] starting in version [8.0]."
);

View file

@ -8,6 +8,7 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.common.time.DateFormatter;
@ -246,7 +247,7 @@ public class DateFieldMapperTests extends MapperTestCase {
public void testBadNullValue() throws IOException {
createDocumentMapper(fieldMapping(b -> b.field("type", "date").field("null_value", "foo")));
assertWarnings("Error parsing [foo] as date in [null_value] on field [field]); [null_value] will be ignored");
assertWarnings(Level.WARN, "Error parsing [foo] as date in [null_value] on field [field]); [null_value] will be ignored");
}
public void testNullConfigValuesFail() {

View file

@ -7,6 +7,7 @@
*/
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
@ -60,7 +61,7 @@ public class FieldNamesFieldTypeTests extends ESTestCase {
);
Query termQuery = fieldNamesFieldType.termQuery("field_name", searchExecutionContext);
assertEquals(new TermQuery(new Term(FieldNamesFieldMapper.CONTENT_TYPE, "field_name")), termQuery);
assertWarnings("terms query on the _field_names field is deprecated and will be removed, use exists query instead");
assertWarnings(Level.WARN, "terms query on the _field_names field is deprecated and will be removed, use exists query instead");
FieldNamesFieldMapper.FieldNamesFieldType unsearchable = FieldNamesFieldMapper.FieldNamesFieldType.get(false);
IllegalStateException e = expectThrows(IllegalStateException.class, () -> unsearchable.termQuery("field_name", null));

View file

@ -7,6 +7,7 @@
*/
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.geo.Orientation;
import org.elasticsearch.core.List;
@ -210,7 +211,7 @@ public class GeoShapeFieldMapperTests extends MapperTestCase {
b.startObject("keyword").field("type", "keyword").endObject();
b.endObject();
}));
assertWarnings("Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future");
assertWarnings(Level.WARN, "Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future");
}
@Override

View file

@ -8,6 +8,7 @@
package org.elasticsearch.index.query.functionscore;
import org.apache.logging.log4j.Level;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.settings.Settings;
@ -56,7 +57,10 @@ public class ScoreFunctionBuilderTests extends ESTestCase {
Mockito.when(context.getFieldType(IdFieldMapper.NAME)).thenReturn(new KeywordFieldMapper.KeywordFieldType(IdFieldMapper.NAME));
Mockito.when(context.isFieldMapped(IdFieldMapper.NAME)).thenReturn(true);
builder.toFunction(context);
assertWarnings("As of version 7.0 Elasticsearch will require that a [field] parameter is provided when a [seed] is set");
assertWarnings(
Level.WARN,
"As of version 7.0 Elasticsearch will require that a [field] parameter is provided when a [seed] is set"
);
}
public void testRandomScoreFunctionWithSeed() throws Exception {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.indices.analysis;
import org.apache.logging.log4j.Level;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharFilter;
import org.apache.lucene.analysis.MockTokenizer;
@ -117,7 +118,7 @@ public class AnalysisModuleTests extends ESTestCase {
public void testSimpleConfigurationYaml() throws IOException {
Settings settings = loadFromClasspath("/org/elasticsearch/index/analysis/test1.yml");
testSimpleConfiguration(settings);
assertWarnings("Setting [version] on analysis component [custom7] has no effect and is deprecated");
assertWarnings(Level.WARN, "Setting [version] on analysis component [custom7] has no effect and is deprecated");
}
public void testVersionedAnalyzers() throws Exception {
@ -131,7 +132,7 @@ public class AnalysisModuleTests extends ESTestCase {
IndexAnalyzers indexAnalyzers = getIndexAnalyzers(newRegistry, settings2);
assertThat(indexAnalyzers.get("custom7").analyzer(), is(instanceOf(StandardAnalyzer.class)));
assertWarnings("Setting [version] on analysis component [custom7] has no effect and is deprecated");
assertWarnings(Level.WARN, "Setting [version] on analysis component [custom7] has no effect and is deprecated");
}
private void testSimpleConfiguration(Settings settings) throws IOException {
@ -229,7 +230,7 @@ public class AnalysisModuleTests extends ESTestCase {
.put(IndexMetadata.SETTING_VERSION_CREATED, version)
.build();
getIndexAnalyzers(settings);
assertWarnings("The [standard] token filter is deprecated and will be removed in a future version.");
assertWarnings(Level.WARN, "The [standard] token filter is deprecated and will be removed in a future version.");
}
}

View file

@ -9,6 +9,7 @@ package org.elasticsearch.search;
import com.carrotsearch.hppc.IntArrayList;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.FilterDirectoryReader;
import org.apache.lucene.index.LeafReader;
@ -1234,7 +1235,7 @@ public class SearchServiceTests extends ESSingleNodeTestCase {
client().prepareIndex(indexName, "_doc").setId("1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();
assertHitCount(client().prepareSearch().get(), 0L);
assertHitCount(client().prepareSearch().setIndicesOptions(IndicesOptions.STRICT_EXPAND_OPEN_FORBID_CLOSED).get(), 1L);
assertWarnings(TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
assertWarnings(Level.WARN, TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
}
public void testCreateReduceContext() {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.search.aggregations.bucket.histogram;
import org.apache.logging.log4j.Level;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongPoint;
@ -427,7 +428,7 @@ public class AutoDateHistogramAggregatorTests extends DateHistogramAggregatorTes
d.add(new SortedNumericDocValuesField(fieldName, 0));
iw.addDocument(d);
}, a -> {}, new BooleanFieldMapper.BooleanFieldType(fieldName));
assertWarnings("Running AutoIntervalDateHistogram aggregations on [boolean] fields is deprecated");
assertWarnings(Level.WARN, "Running AutoIntervalDateHistogram aggregations on [boolean] fields is deprecated");
}
public void testUnmappedMissing() throws IOException {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.search.aggregations.bucket.histogram;
import org.apache.logging.log4j.Level;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.document.NumericDocValuesField;
@ -103,7 +104,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
a -> {},
new BooleanFieldMapper.BooleanFieldType(fieldName)
);
assertWarnings("Running DateHistogram aggregations on [boolean] fields is deprecated");
assertWarnings(Level.WARN, "Running DateHistogram aggregations on [boolean] fields is deprecated");
}
public void testMatchNoDocs() throws IOException {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.search.aggregations.bucket.range;
import org.apache.logging.log4j.Level;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.IntPoint;
import org.apache.lucene.document.LongPoint;
@ -63,7 +64,7 @@ public class DateRangeAggregatorTests extends AggregatorTestCase {
d.add(new SortedNumericDocValuesField(fieldName, 0));
iw.addDocument(d);
}, a -> {}, new BooleanFieldMapper.BooleanFieldType(fieldName));
assertWarnings("Running Range or DateRange aggregations on [boolean] fields is deprecated");
assertWarnings(Level.WARN, "Running Range or DateRange aggregations on [boolean] fields is deprecated");
}
public void testNoMatchingField() throws IOException {

View file

@ -8,6 +8,7 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexableField;
@ -21,6 +22,7 @@ import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.CheckedConsumer;
import org.elasticsearch.core.Set;
@ -223,17 +225,21 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
assertParseMaximalWarnings();
}
protected Level getWarningLevel() {
return DeprecationLogger.CRITICAL;
}
protected final void assertParseMinimalWarnings() {
String[] warnings = getParseMinimalWarnings();
if (warnings.length > 0) {
assertWarnings(warnings);
assertWarnings(getWarningLevel(), warnings);
}
}
protected final void assertParseMaximalWarnings() {
String[] warnings = getParseMaximalWarnings();
if (warnings.length > 0) {
assertWarnings(warnings);
assertWarnings(getWarningLevel(), warnings);
}
}
@ -728,7 +734,7 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
expectThrows(MapperParsingException.class, () -> mapper.parse(source(b -> b.nullField("field"))));
}
assertWarnings(getParseMinimalWarnings());
assertWarnings(getWarningLevel(), getParseMinimalWarnings());
}
protected boolean allowsNullValues() {

View file

@ -243,7 +243,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);
}
}

View file

@ -55,7 +55,7 @@ public class DeprecatedQueryBuilder extends AbstractQueryBuilder<DeprecatedQuery
@Override
protected Query doToQuery(SearchExecutionContext context) {
deprecationLogger.critical(DeprecationCategory.OTHER, "to_query", "[deprecated] query");
deprecationLogger.warn(DeprecationCategory.OTHER, "to_query", "[deprecated] query");
return new MatchAllDocsQuery();
}

View file

@ -424,7 +424,7 @@ public class XPackPlugin extends XPackClientPlugin
if (Files.exists(config) == false) {
Path legacyConfig = env.configFile().resolve("x-pack").resolve(name);
if (Files.exists(legacyConfig)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"config_file_path",
"Config file ["

View file

@ -375,7 +375,7 @@ public final class IndicesPermission {
for (String privilegeName : group.privilege.name()) {
if (PRIVILEGE_NAME_SET_BWC_ALLOW_MAPPING_UPDATE.contains(privilegeName)) {
bwcDeprecationLogActions.add(() -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"[" + resource.name + "] mapping update for ingest privilege [" + privilegeName + "]",
"the index privilege ["

View file

@ -125,7 +125,7 @@ public class GetTransformAction extends ActionType<GetTransformAction.Response>
builder.field(TransformField.COUNT.getPreferredName(), invalidTransforms.size());
builder.field(TransformField.TRANSFORMS.getPreferredName(), invalidTransforms);
builder.endObject();
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
"invalid_transforms",
INVALID_TRANSFORMS_DEPRECATION_WARNING,

View file

@ -88,7 +88,7 @@ public class PivotConfig implements Writeable, ToXContentObject {
this.maxPageSearchSize = maxPageSearchSize;
if (maxPageSearchSize != null) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
TransformField.MAX_PAGE_SEARCH_SIZE.getPreferredName(),
TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED

View file

@ -97,7 +97,7 @@ public class MockDeprecatedAggregationBuilder extends ValuesSourceAggregationBui
}
public static MockDeprecatedAggregationBuilder fromXContent(XContentParser p) {
deprecationLogger.critical(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE);
deprecationLogger.warn(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE);
return new MockDeprecatedAggregationBuilder();
}
}

View file

@ -46,7 +46,7 @@ public class MockDeprecatedQueryBuilder extends AbstractQueryBuilder<MockDepreca
public static MockDeprecatedQueryBuilder fromXContent(XContentParser parser) {
try {
deprecationLogger.critical(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE);
deprecationLogger.warn(DeprecationCategory.OTHER, "deprecated_mock", DEPRECATION_MESSAGE);
return PARSER.apply(parser, null);
} catch (IllegalArgumentException e) {

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.transform.action;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.logging.LoggerMessageFormat;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
@ -52,7 +53,7 @@ public class GetTransformActionResponseTests extends AbstractWireSerializingTran
expectedInvalidTransforms.add(transforms.get(1).getId());
expectedInvalidTransforms.add(transforms.get(3).getId());
assertEquals(expectedInvalidTransforms, XContentMapValues.extractValue("invalid_transforms.transforms", responseAsMap));
assertWarnings(LoggerMessageFormat.format(Response.INVALID_TRANSFORMS_DEPRECATION_WARNING, 2));
assertWarnings(Level.WARN, LoggerMessageFormat.format(Response.INVALID_TRANSFORMS_DEPRECATION_WARNING, 2));
}
@SuppressWarnings("unchecked")

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.transform.transforms;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.ValidationException;
import org.elasticsearch.common.bytes.BytesReference;
@ -147,7 +148,7 @@ public class QueryConfigTests extends AbstractSerializingTransformTestCase<Query
try (XContentParser parser = createParser(JsonXContent.jsonXContent, source)) {
QueryConfig query = QueryConfig.fromXContent(parser, false);
assertNotNull(query.getQuery());
assertWarnings(MockDeprecatedQueryBuilder.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, MockDeprecatedQueryBuilder.DEPRECATION_MESSAGE);
}
}
}

View file

@ -43,6 +43,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.apache.logging.log4j.Level.WARN;
import static org.elasticsearch.test.TestMatchers.matchesPattern;
import static org.elasticsearch.xpack.core.transform.transforms.DestConfigTests.randomDestConfig;
import static org.elasticsearch.xpack.core.transform.transforms.SourceConfigTests.randomInvalidSourceConfig;
@ -511,7 +512,7 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
assertTrue(transformConfigRewritten.getSettings().getDatesAsEpochMillis());
assertFalse(transformConfigRewritten.getSettings().getAlignCheckpoints());
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertEquals(Version.CURRENT, transformConfigRewritten.getVersion());
}
@ -584,7 +585,7 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
assertNotNull(transformConfigRewritten.getSettings().getMaxPageSearchSize());
assertEquals(555L, transformConfigRewritten.getSettings().getMaxPageSearchSize().longValue());
assertEquals(Version.CURRENT, transformConfigRewritten.getVersion());
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
}
public void testRewriteForBWCOfDateNormalization() throws IOException {
@ -740,7 +741,7 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
TransformConfig deprecatedConfig = randomTransformConfigWithDeprecatedFields(id, Version.CURRENT);
// check _and_ clear warnings
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
// important: checkForDeprecations does _not_ create new deprecation warnings
assertThat(
@ -765,7 +766,7 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
deprecatedConfig = randomTransformConfigWithDeprecatedFields(id, Version.V_7_10_0);
// check _and_ clear warnings
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
// important: checkForDeprecations does _not_ create new deprecation warnings
assertThat(
@ -790,7 +791,7 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
deprecatedConfig = randomTransformConfigWithDeprecatedFields(id, Version.V_7_4_0);
// check _and_ clear warnings
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
// important: checkForDeprecations does _not_ create new deprecation warnings
assertThat(

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.transform.transforms.pivot;
import org.apache.logging.log4j.Level;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.ValidationException;
import org.elasticsearch.common.bytes.BytesReference;
@ -137,7 +138,7 @@ public class AggregationConfigTests extends AbstractSerializingTransformTestCase
try (XContentParser parser = createParser(JsonXContent.jsonXContent, source)) {
AggregationConfig agg = AggregationConfig.fromXContent(parser, false);
assertNull(agg.validate(null));
assertWarnings(MockDeprecatedAggregationBuilder.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, MockDeprecatedAggregationBuilder.DEPRECATION_MESSAGE);
}
}

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.core.transform.transforms.pivot;
import org.apache.logging.log4j.Level;
import org.elasticsearch.Version;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.ValidationException;
@ -438,7 +439,7 @@ public class PivotConfigTests extends AbstractSerializingTransformTestCase<Pivot
public void testDeprecation() {
PivotConfig pivotConfig = randomPivotConfigWithDeprecatedFields();
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(Level.WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
}
private static String dotJoin(String... fields) {

View file

@ -67,7 +67,7 @@ public class TestDeprecatedQueryBuilder extends AbstractQueryBuilder<TestDepreca
@Override
protected Query doToQuery(SearchExecutionContext context) throws IOException {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.OTHER,
NAME,
"[{}] query is deprecated, but used on [{}] index",

View file

@ -1069,6 +1069,7 @@ public class NodeDeprecationChecksTests extends ESTestCase {
equalTo(expectedIssue)
);
assertWarnings(
Level.WARN,
String.format(
Locale.ROOT,
"Fractional bytes values are deprecated. Use non-fractional bytes values instead: [%s] " + "found for setting [%s]",

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.index.engine.frozen;
import org.apache.logging.log4j.Level;
import org.elasticsearch.action.OriginalIndices;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
@ -162,7 +163,7 @@ public class FrozenIndexTests extends ESSingleNodeTestCase {
assertFalse(((FrozenEngine) engine).isReaderOpen());
}
}
assertWarnings(TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
assertWarnings(Level.WARN, TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
} finally {
client().execute(ClosePointInTimeAction.INSTANCE, new ClosePointInTimeRequest(pitId)).get();
}
@ -218,7 +219,7 @@ public class FrozenIndexTests extends ESSingleNodeTestCase {
}
IndicesStatsResponse index = client().admin().indices().prepareStats(indexName).clear().setRefresh(true).get();
assertEquals(numRefreshes, index.getTotal().refresh.getTotal());
assertWarnings(TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
assertWarnings(Level.WARN, TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
}
public void testFreezeAndUnfreeze() throws ExecutionException, InterruptedException {
@ -323,7 +324,7 @@ public class FrozenIndexTests extends ESSingleNodeTestCase {
assertEquals(1, index.getTotal().refresh.getTotal());
index = client().admin().indices().prepareStats("test-idx-1").clear().setRefresh(true).get();
assertEquals(0, index.getTotal().refresh.getTotal());
assertWarnings(TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
assertWarnings(Level.WARN, TransportSearchAction.FROZEN_INDICES_DEPRECATION_MESSAGE.replace("{}", indexName));
}
public void testCanMatch() throws IOException, ExecutionException, InterruptedException {

View file

@ -75,7 +75,7 @@ public class RestGetTrainedModelsAction extends BaseRestHandler {
);
final GetTrainedModelsAction.Request request;
if (restRequest.hasParam(GetTrainedModelsAction.Request.INCLUDE_MODEL_DEFINITION)) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
GetTrainedModelsAction.Request.INCLUDE_MODEL_DEFINITION,
"[{}] parameter is deprecated! Use [include=definition] instead.",

View file

@ -163,7 +163,7 @@ public final class DomainSplitFunction {
public static List<String> domainSplit(String host, Map<String, Object> params) {
// NOTE: we don't check SpecialPermission because this will be called (indirectly) from scripts
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"domainSplit",
"Method [domainSplit] taking params is deprecated. Remove the params argument."

View file

@ -119,7 +119,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.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"deprecated_timezone",
"Creating Rollup job ["

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.rollup.action;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.Version;
@ -466,6 +467,7 @@ public class PutJobStateMachineTests extends ESTestCase {
PutRollupJobAction.Request request = new PutRollupJobAction.Request(config);
TransportPutRollupJobAction.checkForDeprecatedTZ(request);
assertWarnings(
Level.WARN,
"Creating Rollup job [foo] with timezone [Japan], but [Japan] has been deprecated by the IANA. " + "Use [Asia/Tokyo] instead."
);
}

View file

@ -972,7 +972,7 @@ public class ApiKeyService {
@Override
public void usedDeprecatedName(String parserName, Supplier<XContentLocation> location, String usedName, String modernName) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"api_key_field",
"{}Deprecated field [{}] used in api key [{}], expected [{}] instead",
@ -986,7 +986,7 @@ public class ApiKeyService {
@Override
public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName, String replacedWith) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"api_key_field",
"{}Deprecated field [{}] used in api key [{}], replaced by [{}]",
@ -1000,7 +1000,7 @@ public class ApiKeyService {
@Override
public void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName) {
String prefix = parserName == null ? "" : "[" + parserName + "][" + location.get() + "] ";
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"api_key_field",
"{}Deprecated field [{}] used in api key [{}], which is unused and will be removed entirely",

View file

@ -513,7 +513,7 @@ public class Realms implements Iterable<Realm> {
private void logDeprecationForReservedPrefixedRealmNames(List<RealmConfig.RealmIdentifier> realmIdentifiers) {
if (false == realmIdentifiers.isEmpty()) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"realm_name_with_reserved_prefix",
"Found realm "

View file

@ -247,7 +247,7 @@ public class ReservedRealm extends CachingUsernamePasswordRealm {
private void logDeprecatedUser(final User user) {
Map<String, Object> metadata = user.metadata();
if (Boolean.TRUE.equals(metadata.get(MetadataUtils.DEPRECATED_METADATA_KEY))) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"deprecated_user-" + user.principal(),
"The user ["

View file

@ -720,7 +720,7 @@ class ActiveDirectorySessionFactory extends PoolingSessionFactory {
threadPool
);
if (userSearchFilter.contains("{0}")) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"ldap_settings",
"The use of the account name variable {0} in the setting ["

View file

@ -170,7 +170,7 @@ public abstract class SessionFactory {
final String fullSettingKey = RealmSettings.getFullSettingKey(config, SessionFactorySettings.HOSTNAME_VERIFICATION_SETTING);
final String deprecationKey = "deprecated_setting_" + fullSettingKey.replace('.', '_');
DeprecationLogger.getLogger(logger.getName())
.critical(
.warn(
DeprecationCategory.SECURITY,
deprecationKey,
"the setting [{}] has been deprecated and will be removed in a future version. use [{}] instead",

View file

@ -226,7 +226,7 @@ public class CompositeRolesStore {
rd.getMetadata().get(MetadataUtils.DEPRECATED_REASON_METADATA_KEY),
"Please check the documentation"
);
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"deprecated_role-" + rd.getName(),
"The role [" + rd.getName() + "] is deprecated and will be removed in a future version of Elasticsearch. " + reason

View file

@ -211,7 +211,7 @@ public final class DeprecationRoleDescriptorConsumer implements Consumer<Collect
aliasName,
String.join(", ", inferiorIndexNames)
);
deprecationLogger.critical(DeprecationCategory.SECURITY, "index_permissions_on_alias", logMessage);
deprecationLogger.warn(DeprecationCategory.SECURITY, "index_permissions_on_alias", logMessage);
}
}
}

View file

@ -1054,6 +1054,7 @@ public class RealmsTests extends ESTestCase {
new Realms(settings, env, factories, licenseState, threadContext, reservedRealm);
assertWarnings(
Level.WARN,
"Found realm "
+ (invalidRealmNames.size() == 1 ? "name" : "names")
+ " with reserved prefix [_]: ["

View file

@ -10,6 +10,7 @@ import com.unboundid.ldap.sdk.LDAPConnectionOptions;
import com.unboundid.util.ssl.HostNameSSLSocketVerifier;
import com.unboundid.util.ssl.TrustAllSSLSocketVerifier;
import org.apache.logging.log4j.Level;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.common.settings.SecureString;
@ -157,6 +158,7 @@ public class SessionFactoryTests extends ESTestCase {
assertThat(options.getResponseTimeoutMillis(), is(equalTo(20L)));
assertThat(options.getSSLSocketVerifier(), is(instanceOf(TrustAllSSLSocketVerifier.class)));
assertWarnings(
Level.WARN,
"the setting [xpack.security.authc.realms.ldap.conn_settings.hostname_verification] has been deprecated and will be "
+ "removed in a future version. use [xpack.security.authc.realms.ldap.conn_settings.ssl.verification_mode] instead"
);

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.security.authz.accesscontrol;
import org.apache.logging.log4j.Level;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.mapping.put.AutoPutMappingAction;
@ -503,6 +504,7 @@ public class IndicesPermissionTests extends ESTestCase {
assertThat(iac.getIndexPermissions("test1").isGranted(), is(true));
assertThat(iac.getIndexPermissions("test_write1").isGranted(), is(true));
assertWarnings(
Level.WARN,
"the index privilege [index] allowed the update mapping action ["
+ PutMappingAction.NAME
+ "] on "
@ -523,6 +525,7 @@ public class IndicesPermissionTests extends ESTestCase {
assertThat(iac.getIndexPermissions("test1").isGranted(), is(true));
assertThat(iac.getIndexPermissions("test_write1").isGranted(), is(true));
assertWarnings(
Level.WARN,
"the index privilege [index] allowed the update mapping action ["
+ AutoPutMappingAction.NAME
+ "] on "

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.security.authz.store;
import org.apache.logging.log4j.Level;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsAction;
@ -1456,6 +1457,7 @@ public class CompositeRolesStoreTests extends ESTestCase {
compositeRolesStore.logDeprecatedRoles(new LinkedHashSet<>(descriptors));
assertWarnings(
Level.WARN,
"The role ["
+ deprecated1.getName()
+ "] is deprecated and will be removed in a future version of Elasticsearch."

View file

@ -368,7 +368,7 @@ public final class DeprecationRoleDescriptorConsumerTests extends ESTestCase {
}
private void verifyLogger(DeprecationLogger deprecationLogger, String roleName, String aliasName, String indexNames) {
verify(deprecationLogger).critical(
verify(deprecationLogger).warn(
DeprecationCategory.SECURITY,
"index_permissions_on_alias",
"Role ["

View file

@ -119,7 +119,7 @@ public class GeoShapeWithDocValuesFieldMapper extends AbstractShapeGeometryField
@Override
public GeoShapeWithDocValuesFieldMapper 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

@ -93,7 +93,7 @@ public class PointFieldMapper extends AbstractPointGeometryFieldMapper<Cartesian
@Override
public FieldMapper build(MapperBuilderContext context) {
if (multiFieldsBuilder.hasMultiFields()) {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"point_multifields",
"Adding multifields to [point] mappers has no effect and will be forbidden in future"

View file

@ -82,7 +82,7 @@ public class ShapeFieldMapper extends AbstractShapeGeometryFieldMapper<Geometry>
@Override
public ShapeFieldMapper build(MapperBuilderContext context) {
if (multiFieldsBuilder.hasMultiFields()) {
DEPRECATION_LOGGER.critical(
DEPRECATION_LOGGER.warn(
DeprecationCategory.MAPPINGS,
"shape_multifields",
"Adding multifields to [shape] mappers has no effect and will be forbidden in future"

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.spatial.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.Version;
import org.elasticsearch.common.Strings;
@ -386,7 +387,7 @@ public class GeoShapeWithDocValuesFieldMapperTests extends MapperTestCase {
b.startObject("keyword").field("type", "keyword").endObject();
b.endObject();
}));
assertWarnings("Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future");
assertWarnings(Level.WARN, "Adding multifields to [geo_shape] mappers has no effect and will be forbidden in future");
}
public void testRandomVersionMapping() throws Exception {

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.spatial.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MappedFieldType;
@ -232,7 +233,7 @@ public class PointFieldMapperTests extends CartesianFieldMapperTests {
b.startObject("keyword").field("type", "keyword").endObject();
b.endObject();
}));
assertWarnings("Adding multifields to [point] mappers has no effect and will be forbidden in future");
assertWarnings(Level.WARN, "Adding multifields to [point] mappers has no effect and will be forbidden in future");
}
@Override

View file

@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.spatial.index.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.geo.Orientation;
@ -247,7 +248,7 @@ public class ShapeFieldMapperTests extends CartesianFieldMapperTests {
b.startObject("keyword").field("type", "keyword").endObject();
b.endObject();
}));
assertWarnings("Adding multifields to [shape] mappers has no effect and will be forbidden in future");
assertWarnings(Level.WARN, "Adding multifields to [shape] mappers has no effect and will be forbidden in future");
}
public String toXContentString(ShapeFieldMapper mapper) {

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.transform.transforms.pivot;
import org.apache.logging.log4j.Level;
import org.apache.lucene.search.TotalHits;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
@ -137,7 +138,7 @@ public class PivotTests extends ESTestCase {
);
assertThat(pivot.getInitialPageSize(), equalTo(Transform.DEFAULT_INITIAL_MAX_PAGE_SEARCH_SIZE));
assertWarnings(TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
assertWarnings(Level.WARN, TransformDeprecations.ACTION_MAX_PAGE_SEARCH_SIZE_IS_DEPRECATED);
}
public void testSearchFailure() throws Exception {

View file

@ -80,7 +80,7 @@ public class SparseVectorFieldMapper extends FieldMapper {
}
public static final TypeParser PARSER = new TypeParser((n, c) -> {
deprecationLogger.critical(DeprecationCategory.API, "sparse_vector", DEPRECATION_MESSAGE);
deprecationLogger.warn(DeprecationCategory.API, "sparse_vector", DEPRECATION_MESSAGE);
return new Builder(n, c.indexVersionCreated());
}, notInMultiFields(CONTENT_TYPE));

View file

@ -7,6 +7,7 @@
package org.elasticsearch.xpack.vectors.mapper;
import org.apache.logging.log4j.Level;
import org.apache.lucene.document.BinaryDocValuesField;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.util.BytesRef;
@ -104,7 +105,7 @@ public class SparseVectorFieldMapperTests extends MapperTestCase {
float decodedMagnitude = VectorEncoderDecoder.decodeMagnitude(indexVersion, vectorBR);
assertEquals(expectedMagnitude, decodedMagnitude, 0.001f);
assertWarnings(SparseVectorFieldMapper.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, SparseVectorFieldMapper.DEPRECATION_MESSAGE);
}
public void testAddDocumentsToIndexBefore_V_7_5_0() throws Exception {
@ -135,7 +136,7 @@ public class SparseVectorFieldMapperTests extends MapperTestCase {
float[] decodedValues = VectorEncoderDecoder.decodeSparseVector(indexVersion, vectorBR);
assertArrayEquals("Decoded sparse vector values are not equal to the indexed ones.", expectedValues, decodedValues, 0.001f);
assertWarnings(SparseVectorFieldMapper.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, SparseVectorFieldMapper.DEPRECATION_MESSAGE);
}
public void testDimensionNumberValidation() throws IOException {
@ -196,7 +197,7 @@ public class SparseVectorFieldMapperTests extends MapperTestCase {
containsString("takes an object that maps a dimension number to a float, but got unexpected token [START_ARRAY]")
);
assertWarnings(SparseVectorFieldMapper.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, SparseVectorFieldMapper.DEPRECATION_MESSAGE);
}
public void testDimensionLimit() throws IOException {
@ -218,7 +219,7 @@ public class SparseVectorFieldMapperTests extends MapperTestCase {
);
assertThat(e.getDetailedMessage(), containsString("has exceeded the maximum allowed number of dimensions"));
assertWarnings(SparseVectorFieldMapper.DEPRECATION_MESSAGE);
assertWarnings(Level.WARN, SparseVectorFieldMapper.DEPRECATION_MESSAGE);
}
@Override
@ -254,4 +255,8 @@ public class SparseVectorFieldMapperTests extends MapperTestCase {
})));
assertThat(e.getMessage(), containsString("Field [vectors] of type [sparse_vector] can't be used in multifields"));
}
protected Level getWarningLevel() {
return Level.WARN;
}
}

View file

@ -62,7 +62,7 @@ public class RestWatcherStatsAction extends WatcherRestHandler {
}
if (metrics.contains("pending_watches")) {
deprecationLogger.critical(
deprecationLogger.warn(
DeprecationCategory.API,
"pending_watches",
"The pending_watches parameter is deprecated, use queued_watches instead"