Skip to content

Commit eab1b3f

Browse files
authored
[8.x] Adjust details in the SourceFieldMapper deprecation warning (#122083) (#122098)
* [Deprecation API] Adjust details in the SourceFieldMapper deprecation warning (#122041) * Update test
1 parent ff43a24 commit eab1b3f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public class SourceFieldMapper extends MetadataFieldMapper {
7171

7272
public static final String LOSSY_PARAMETERS_ALLOWED_SETTING_NAME = "index.lossy.source-mapping-parameters";
7373

74+
public static final String DEPRECATION_WARNING_TITLE = "Configuring source mode in mappings is deprecated.";
75+
7476
public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated and will be removed "
7577
+ "in future versions. Use [index.mapping.source.mode] index setting instead.";
7678

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_TITLE,
126+
"https://ela.st/migrate-source-mode",
125127
SourceFieldMapper.DEPRECATION_WARNING,
126-
"https://github.com/elastic/elasticsearch/pull/117172",
127-
null,
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_TITLE,
55+
"https://ela.st/migrate-source-mode",
5456
SourceFieldMapper.DEPRECATION_WARNING,
55-
"https://github.com/elastic/elasticsearch/pull/117172",
56-
null,
5757
false,
5858
null
5959
);

x-pack/plugin/logsdb/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/LogsIndexModeCustomSettingsIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ private void assertDeprecationWarningForTemplate(String templateName) throws IOE
520520
Map<?, ?> issuesByTemplate = (Map<?, ?>) response.get("templates");
521521
assertThat(issuesByTemplate.containsKey(templateName), equalTo(true));
522522
var templateIssues = (List<?>) issuesByTemplate.get(templateName);
523-
assertThat(((Map<?, ?>) templateIssues.get(0)).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
523+
assertThat(((Map<?, ?>) templateIssues.get(0)).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
524+
assertThat(((Map<?, ?>) templateIssues.get(0)).get("details"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
524525
}
525526
}

0 commit comments

Comments
 (0)