Skip to content

Commit

Permalink
Updating deprecation info API to use shortened URLs (#78026)
Browse files Browse the repository at this point in the history
This commit updates the deprecation info API to use shortened https://ela.st URLs that can be adjusted to point to
different documentation URLs without having to modify the source code.
Relates #42404
  • Loading branch information
masseyke committed Sep 21, 2021
1 parent eb2a64c commit 11931d7
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static DeprecationIssue checkUserAgentPipelines(ClusterState state) {
if (pipelinesWithDeprecatedEcsConfig.isEmpty() == false) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"User-Agent ingest plugin will always use ECS-formatted output",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/user-agent-processor.html#user-agent-processor",
"https://ela.st/es-deprecation-7-ingest-pipeline-ecs-option",
"Ingest pipelines " + pipelinesWithDeprecatedEcsConfig +
" uses the [ecs] option which needs to be removed to work in 8.0", false, null);
}
Expand Down Expand Up @@ -97,8 +97,7 @@ static DeprecationIssue checkTemplatesWithTooManyFields(ClusterState state) {
if (templatesOverLimit.isEmpty() == false) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Fields in index template exceed automatic field expansion limit",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html" +
"#_limiting_the_number_of_auto_expanded_fields",
"https://ela.st/es-deprecation-7-number-of-auto-expanded-fields",
"Index templates " + templatesOverLimit + " have a number of fields which exceeds the automatic field expansion " +
"limit of [" + maxClauseCount + "] and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, " +
"which may cause queries which use automatic field expansion, such as query_string, simple_query_string, and " +
Expand Down Expand Up @@ -133,7 +132,7 @@ static DeprecationIssue checkTemplatesWithFieldNamesDisabled(ClusterState state)

if (templatesContainingFieldNames.isEmpty() == false) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING, "Index templates contain _field_names settings.",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/mapping-field-names-field.html#disable-field-names",
"https://ela.st/es-deprecation-7-field_names-settings",
"Index templates " + templatesContainingFieldNames + " use the deprecated `enable` setting for the `"
+ FieldNamesFieldMapper.NAME + "` field. Using this setting in new index mappings will throw an error "
+ "in the next major version and needs to be removed from existing mappings and templates.",
Expand Down Expand Up @@ -172,8 +171,7 @@ static DeprecationIssue checkPollIntervalTooLow(ClusterState state) {
if (pollInterval.compareTo(TimeValue.timeValueSeconds(1)) < 0) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Index Lifecycle Management poll interval is set too low",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" +
"#ilm-poll-interval-limit",
"https://ela.st/es-deprecation-7-indices-lifecycle-poll-interval-setting",
"The Index Lifecycle Management poll interval setting [" + LIFECYCLE_POLL_INTERVAL_SETTING.getKey() + "] is " +
"currently set to [" + pollIntervalString + "], but must be 1s or greater", false, null);
}
Expand All @@ -194,7 +192,7 @@ static DeprecationIssue checkTemplatesWithMultipleTypes(ClusterState state) {
}
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Some index templates contain multiple mapping types",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/removal-of-types.html",
"https://ela.st/es-deprecation-7-multiple-types",
"Index templates " + templatesWithMultipleTypes
+ " define multiple types and so will cause errors when used in index creation",
false,
Expand All @@ -204,7 +202,7 @@ static DeprecationIssue checkTemplatesWithMultipleTypes(ClusterState state) {
static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(final ClusterState clusterState) {
return checkRemovedSetting(clusterState.metadata().settings(),
CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING,
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-cluster.html#disk-based-shard-allocation",
"https://ela.st/es-deprecation-7-cluster-routing-allocation-disk-include-relocations-setting",
DeprecationIssue.Level.WARNING
);
}
Expand Down Expand Up @@ -273,8 +271,7 @@ static DeprecationIssue checkGeoShapeTemplates(final ClusterState clusterState)
String detailsForIndexTemplates = getDetailsMessageForGeoShapeIndexTemplates(clusterState.getMetadata().getTemplates());
boolean deprecationInComponentTemplates = Strings.isEmpty(detailsForComponentTemplates) == false;
boolean deprecationInIndexTemplates = Strings.isEmpty(detailsForIndexTemplates) == false;
String url = "https://www.elastic.co/guide/en/elasticsearch/reference/6.6/breaking-changes-6.6.html" +
"#_deprecated_literal_geo_shape_literal_parameters";
String url = "https://ela.st/es-deprecation-7-geo-shape-mappings";
if (deprecationInComponentTemplates && deprecationInIndexTemplates) {
String message = "component templates and index templates contain deprecated geo_shape properties that must be removed";
String details = detailsForComponentTemplates + "; " + detailsForIndexTemplates;
Expand Down Expand Up @@ -365,7 +362,7 @@ static DeprecationIssue checkSparseVectorTemplates(final ClusterState clusterSta
String detailsForIndexTemplates = getDetailsMessageForSparseVectorIndexTemplates(clusterState.getMetadata().getTemplates());
boolean deprecationInComponentTemplates = Strings.isEmpty(detailsForComponentTemplates) == false;
boolean deprecationInIndexTemplates = Strings.isEmpty(detailsForIndexTemplates) == false;
String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_search_changes";
String url = "https://ela.st/es-deprecation-7-sparse-vector";
if (deprecationInComponentTemplates && deprecationInIndexTemplates) {
String message = "component templates and index templates contain deprecated sparse_vector fields that must be removed";
String details = detailsForComponentTemplates + "; " + detailsForIndexTemplates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ static DeprecationIssue oldIndicesCheck(IndexMetadata indexMetadata) {
if (createdWith.before(Version.V_7_0_0)) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Index created before 7.0",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/" +
"breaking-changes-8.0.html",
"https://ela.st/es-deprecation-7-reindex",
"This index was created using version: " + createdWith,
false, null);
}
Expand All @@ -135,8 +134,7 @@ static DeprecationIssue tooManyFieldsCheck(IndexMetadata indexMetadata) {
if (fieldCount.get() > 1024) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Number of fields exceeds automatic field expansion limit",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html" +
"#_limiting_the_number_of_auto_expanded_fields",
"https://ela.st/es-deprecation-7-number-of-auto-expanded-fields",
"This index has [" + fieldCount.get() + "] fields, which exceeds the automatic field expansion limit of 1024 " +
"and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, which may cause queries which use " +
"automatic field expansion, such as query_string, simple_query_string, and multi_match to fail if fields are not " +
Expand All @@ -159,7 +157,7 @@ static DeprecationIssue deprecatedDateTimeFormat(IndexMetadata indexMetadata) {
if (fields.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Date field format uses patterns which has changed meaning in 7.0",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html#breaking_70_java_time_changes",
"https://ela.st/es-deprecation-7-java-time",
"This index has date fields with deprecated formats: " + fields + ". "
+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null);
}
Expand All @@ -181,8 +179,7 @@ static DeprecationIssue chainedMultiFieldsCheck(IndexMetadata indexMetadata) {
if (issues.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Multi-fields within multi-fields",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.3.html" +
"#_defining_multi_fields_within_multi_fields",
"https://ela.st/es-deprecation-7-chained-multi-fields",
"The names of fields that contain chained multi-fields: " + issues, false, null);
}
return null;
Expand All @@ -209,7 +206,7 @@ static DeprecationIssue fieldNamesDisabledCheck(IndexMetadata indexMetadata) {
if ((mapping != null) && ClusterDeprecationChecks.mapContainsFieldNamesDisabled(mapping.getSourceAsMap())) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Index mapping contains explicit `_field_names` enabling settings.",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/mapping-field-names-field.html#disable-field-names",
"https://ela.st/es-deprecation-7-field_names-settings",
"The index mapping contains a deprecated `enabled` setting for `_field_names` that should be removed moving foward.",
false, null);
}
Expand Down Expand Up @@ -270,8 +267,7 @@ static DeprecationIssue translogRetentionSettingCheck(IndexMetadata indexMetadat
|| IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(indexMetadata.getSettings())) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"translog retention settings are ignored",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/index-modules-translog.html" +
"#index-modules-translog-retention",
"https://ela.st/es-deprecation-7-translog-settings",
"translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored " +
"because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)",
false, null);
Expand All @@ -284,8 +280,7 @@ static DeprecationIssue checkIndexDataPath(IndexMetadata indexMetadata) {
if (IndexMetadata.INDEX_DATA_PATH_SETTING.exists(indexMetadata.getSettings())) {
final String message = String.format(Locale.ROOT,
"setting [%s] is deprecated and will be removed in a future version", IndexMetadata.INDEX_DATA_PATH_SETTING.getKey());
final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/" +
"breaking-changes-7.13.html#deprecate-shared-data-path-setting";
final String url = "https://ela.st/es-deprecation-7-shared-path-settings";
final String details = "Found index data path configured. Discontinue use of this setting.";
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
}
Expand All @@ -303,8 +298,7 @@ private static DeprecationIssue slowLogSettingCheck(IndexMetadata indexMetadata,
if (setting.exists(indexMetadata.getSettings())) {
final String message = String.format(Locale.ROOT,
"setting [%s] is deprecated and will be removed in a future version", setting.getKey());
final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/7.15/migrating-7.13.html" +
"#breaking_713_infra_core_deprecations";
final String url = "https://ela.st/es-deprecation-7-slowlog-settings";

final String details = String.format(Locale.ROOT, "Found [%s] configured. Discontinue use of this setting. Use thresholds.",
setting.getKey());
Expand All @@ -318,7 +312,7 @@ static DeprecationIssue storeTypeSettingCheck(IndexMetadata indexMetadata) {
if (IndexModule.Type.SIMPLEFS.match(storeType)) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"[simplefs] is deprecated and will be removed in future versions",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.15/index-modules-store.html#file-system",
"https://ela.st/es-deprecation-7-simplefs-store-type",
"[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " +
"Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type " +
"as it offers superior or equivalent performance to [simplefs].", false, null);
Expand All @@ -345,23 +339,23 @@ static DeprecationIssue checkRemovedSetting(final Settings settings,
static DeprecationIssue checkIndexRoutingRequireSetting(IndexMetadata indexMetadata) {
return checkRemovedSetting(indexMetadata.getSettings(),
INDEX_ROUTING_REQUIRE_SETTING,
"https://www.elastic.co/guide/en/elasticsearch/reference/7.14/data-tier-shard-filtering.html#data-tier-allocation-filters",
"https://ela.st/es-deprecation-7-tier-filtering-settings",
DeprecationIssue.Level.CRITICAL
);
}

static DeprecationIssue checkIndexRoutingIncludeSetting(IndexMetadata indexMetadata) {
return checkRemovedSetting(indexMetadata.getSettings(),
INDEX_ROUTING_INCLUDE_SETTING,
"https://www.elastic.co/guide/en/elasticsearch/reference/7.14/data-tier-shard-filtering.html#data-tier-allocation-filters",
"https://ela.st/es-deprecation-7-tier-filtering-settings",
DeprecationIssue.Level.CRITICAL
);
}

static DeprecationIssue checkIndexRoutingExcludeSetting(IndexMetadata indexMetadata) {
return checkRemovedSetting(indexMetadata.getSettings(),
INDEX_ROUTING_EXCLUDE_SETTING,
"https://www.elastic.co/guide/en/elasticsearch/reference/7.14/data-tier-shard-filtering.html#data-tier-allocation-filters",
"https://ela.st/es-deprecation-7-tier-filtering-settings",
DeprecationIssue.Level.CRITICAL
);
}
Expand Down Expand Up @@ -399,8 +393,7 @@ static DeprecationIssue checkGeoShapeMappings(IndexMetadata indexMetadata) {
String details = String.format(Locale.ROOT,
"The following geo_shape parameters must be removed from %s: [%s]", indexMetadata.getIndex().getName(),
messages.stream().collect(Collectors.joining("; ")));
String url = "https://www.elastic.co/guide/en/elasticsearch/reference/6.6/breaking-changes-6.6.html" +
"#_deprecated_literal_geo_shape_literal_parameters";
String url = "https://ela.st/es-deprecation-7-geo-shape-mappings";
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
}
}
Expand Down

0 comments on commit 11931d7

Please sign in to comment.