Skip to content

Commit 53a70ea

Browse files
authored
Fixed deprecation info details message for geo_shape (#77384)
Fixed wording in the details message for the deprecation info API for geo_shape fields. Relates #42404 #76627
1 parent 17bf459 commit 53a70ea

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(f
210210
}
211211

212212
@SuppressWarnings("unchecked")
213-
private static String getDetailsMessageForComponentTemplates(Map<String, ComponentTemplate> componentTemplates) {
213+
private static String getDetailsMessageForGeoShapeComponentTemplates(Map<String, ComponentTemplate> componentTemplates) {
214214
String detailsForComponentTemplates =
215215
componentTemplates.entrySet().stream().map((templateCursor) -> {
216216
String templateName = templateCursor.getKey();
@@ -238,7 +238,7 @@ private static String getDetailsMessageForComponentTemplates(Map<String, Compone
238238
}
239239

240240
@SuppressWarnings("unchecked")
241-
private static String getDetailsMessageForIndexTemplates(ImmutableOpenMap<String, IndexTemplateMetadata> indexTemplates) {
241+
private static String getDetailsMessageForGeoShapeIndexTemplates(ImmutableOpenMap<String, IndexTemplateMetadata> indexTemplates) {
242242
String detailsForIndexTemplates =
243243
StreamSupport.stream(indexTemplates.spliterator(), false).map((templateCursor) -> {
244244
String templateName = templateCursor.key;
@@ -268,8 +268,9 @@ private static String getDetailsMessageForIndexTemplates(ImmutableOpenMap<String
268268

269269
@SuppressWarnings("unchecked")
270270
static DeprecationIssue checkGeoShapeTemplates(final ClusterState clusterState) {
271-
String detailsForComponentTemplates = getDetailsMessageForComponentTemplates(clusterState.getMetadata().componentTemplates());
272-
String detailsForIndexTemplates = getDetailsMessageForIndexTemplates(clusterState.getMetadata().getTemplates());
271+
String detailsForComponentTemplates =
272+
getDetailsMessageForGeoShapeComponentTemplates(clusterState.getMetadata().componentTemplates());
273+
String detailsForIndexTemplates = getDetailsMessageForGeoShapeIndexTemplates(clusterState.getMetadata().getTemplates());
273274
boolean deprecationInComponentTemplates = Strings.isEmpty(detailsForComponentTemplates) == false;
274275
boolean deprecationInIndexTemplates = Strings.isEmpty(detailsForIndexTemplates) == false;
275276
String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes";

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ protected static String formatDeprecatedGeoShapeParamMessage(String type, Map.En
377377
Map<?, ?> value = (Map<?, ?>) entry.getValue();
378378
return LegacyGeoShapeFieldMapper.DEPRECATED_PARAMETERS.stream()
379379
.filter(deprecatedParameter -> value.containsKey(deprecatedParameter))
380-
.map(deprecatedParameter -> String.format(Locale.ROOT, "parameter [%s] in field [%s]", type, deprecatedParameter, fieldName))
380+
.map(deprecatedParameter -> String.format(Locale.ROOT, "parameter [%s] in field [%s]", deprecatedParameter, fieldName))
381381
.collect(Collectors.joining("; "));
382382
}
383383

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ public void testCheckGeoShapeMappings() throws Exception {
395395
new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
396396
"index templates contain deprecated geo_shape properties that must be removed",
397397
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes",
398-
"mappings in index template single-type contains deprecated geo_shape properties. [parameter [geo_shape] in field " +
399-
"[points_only]; parameter [geo_shape] in field [strategy]]", false, null)
398+
"mappings in index template single-type contains deprecated geo_shape properties. [parameter [points_only] in field " +
399+
"[location]; parameter [strategy] in field [location]]", false, null)
400400
));
401401

402402
// Second, testing only a component template:
@@ -417,8 +417,8 @@ public void testCheckGeoShapeMappings() throws Exception {
417417
new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
418418
"component templates contain deprecated geo_shape properties that must be removed",
419419
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes",
420-
"mappings in component template my-template contains deprecated geo_shape properties. [parameter [geo_shape] in field " +
421-
"[points_only]; parameter [geo_shape] in field [strategy]]", false, null)
420+
"mappings in component template my-template contains deprecated geo_shape properties. [parameter [points_only] in field " +
421+
"[location]; parameter [strategy] in field [location]]", false, null)
422422
));
423423

424424
// Third, trying a component template and an index template:
@@ -433,10 +433,10 @@ public void testCheckGeoShapeMappings() throws Exception {
433433
new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
434434
"component templates and index templates contain deprecated geo_shape properties that must be removed",
435435
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes",
436-
"mappings in component template my-template contains deprecated geo_shape properties. [parameter [geo_shape] in field " +
437-
"[points_only]; parameter [geo_shape] in field [strategy]]; mappings in index template single-type contains " +
438-
"deprecated geo_shape properties. [parameter [geo_shape] in field [points_only]; parameter [geo_shape] in field " +
439-
"[strategy]]", false, null)
436+
"mappings in component template my-template contains deprecated geo_shape properties. [parameter [points_only] in field " +
437+
"[location]; parameter [strategy] in field [location]]; mappings in index template single-type contains " +
438+
"deprecated geo_shape properties. [parameter [points_only] in field [location]; parameter [strategy] in field " +
439+
"[location]]", false, null)
440440
));
441441
}
442442
}

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ public void testCheckGeoShapeMappings() throws Exception {
608608
new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
609609
"mappings for index test contains deprecated geo_shape properties that must be removed",
610610
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes",
611-
"The following geo_shape parameters must be removed from test: [[parameter [geo_shape] in field [points_only]; parameter " +
612-
"[geo_shape] in field [strategy]]]", false, null)
611+
"The following geo_shape parameters must be removed from test: [[parameter [points_only] in field [location]; parameter " +
612+
"[strategy] in field [location]]]", false, null)
613613
));
614614

615615
Map<String, Object> nestedProperties = Stream.of(new Object[][] {
@@ -627,8 +627,8 @@ public void testCheckGeoShapeMappings() throws Exception {
627627
new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
628628
"mappings for index test contains deprecated geo_shape properties that must be removed",
629629
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_mappings_changes",
630-
"The following geo_shape parameters must be removed from test: [[parameter [geo_shape] in field [points_only]; parameter " +
631-
"[geo_shape] in field [strategy]]]", false, null)
630+
"The following geo_shape parameters must be removed from test: [[parameter [points_only] in field [location]; parameter " +
631+
"[strategy] in field [location]]]", false, null)
632632
));
633633
}
634634
}

0 commit comments

Comments
 (0)