Skip to content

Commit 3a90357

Browse files
committed
Keep the deprecation warning and introduce a title.
1 parent bb38010 commit 3a90357

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SourceModeRollingUpgradeIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void testConfigureStoredSourceBeforeIndexCreationLegacy() throws IOExcept
4646
}
4747
}""";
4848
var putComponentTemplateRequest = new Request("PUT", "/_component_template/" + templateName);
49-
putComponentTemplateRequest.setOptions(expectWarnings(SourceFieldMapper.DEPRECATION_WARNING));
49+
putComponentTemplateRequest.setOptions(expectWarnings(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
5050
putComponentTemplateRequest.setJsonEntity(storedSourceMapping);
5151
assertOK(client().performRequest(putComponentTemplateRequest));
5252
assertDeprecationWarningForTemplate(templateName);
@@ -70,7 +70,7 @@ public void testConfigureStoredSourceWhenIndexIsCreatedLegacy() throws IOExcepti
7070
}
7171
}""";
7272
var putComponentTemplateRequest = new Request("PUT", "/_component_template/" + templateName);
73-
putComponentTemplateRequest.setOptions(expectWarnings(SourceFieldMapper.DEPRECATION_WARNING));
73+
putComponentTemplateRequest.setOptions(expectWarnings(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
7474
putComponentTemplateRequest.setJsonEntity(storedSourceMapping);
7575
assertOK(client().performRequest(putComponentTemplateRequest));
7676
assertDeprecationWarningForTemplate(templateName);
@@ -86,6 +86,7 @@ private void assertDeprecationWarningForTemplate(String templateName) throws IOE
8686
Map<?, ?> issuesByTemplate = (Map<?, ?>) response.get("templates");
8787
assertThat(issuesByTemplate.containsKey(templateName), equalTo(true));
8888
var templateIssues = (List<?>) issuesByTemplate.get(templateName);
89-
assertThat(((Map<?, ?>) templateIssues.getFirst()).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
89+
assertThat(((Map<?, ?>) templateIssues.getFirst()).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
90+
assertThat(((Map<?, ?>) templateIssues.getFirst()).get("details"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
9091
}
9192
}

server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public class SourceFieldMapper extends MetadataFieldMapper {
5858

5959
public static final String LOSSY_PARAMETERS_ALLOWED_SETTING_NAME = "index.lossy.source-mapping-parameters";
6060

61-
public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated.";
61+
public static final String DEPRECATION_WARNING_TITLE = "Configuring source mode in mappings is deprecated.";
6262

63-
public static final String DEPRECATION_DETAILS = "Configuring source mode in mappings is deprecated and will be removed "
63+
public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated and will be removed "
6464
+ "in future versions. Use [index.mapping.source.mode] index setting instead.";
6565

6666
/** The source mode */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ private DeprecationIssue checkSourceModeInComponentTemplates(ComponentTemplate t
122122
if (sourceMap.containsKey("mode")) {
123123
return new DeprecationIssue(
124124
DeprecationIssue.Level.CRITICAL,
125-
SourceFieldMapper.DEPRECATION_WARNING,
125+
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
126126
"https://ela.st/migrate-source-mode",
127-
SourceFieldMapper.DEPRECATION_DETAILS,
127+
SourceFieldMapper.DEPRECATION_WARNING,
128128
false,
129129
null
130130
);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public void testCheckSourceModeInComponentTemplates() throws IOException {
5151
Map<String, List<DeprecationIssue>> issuesByComponentTemplate = checker.check(clusterState);
5252
final DeprecationIssue expected = new DeprecationIssue(
5353
DeprecationIssue.Level.CRITICAL,
54-
SourceFieldMapper.DEPRECATION_WARNING,
54+
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
5555
"https://ela.st/migrate-source-mode",
56-
SourceFieldMapper.DEPRECATION_DETAILS,
56+
SourceFieldMapper.DEPRECATION_WARNING,
5757
false,
5858
null
5959
);

0 commit comments

Comments
 (0)