mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
[Deprecation API] Adjust details in the SourceFieldMapper deprecation warning (#122041)
In this PR we improve the deprecation warning about configuring source in the mapping. - We reduce the size of the warning message so it looks better in kibana. - We keep the original message in the details. - We use an alias help url, so we can associate it with the guide when it's created.
This commit is contained in:
parent
3ed5f73600
commit
1fe1055aef
4 changed files with 14 additions and 6 deletions
|
@ -85,7 +85,13 @@ public class SourceModeRollingUpgradeIT extends AbstractRollingUpgradeTestCase {
|
|||
assertThat(response.containsKey("templates"), equalTo(true));
|
||||
Map<?, ?> issuesByTemplate = (Map<?, ?>) response.get("templates");
|
||||
assertThat(issuesByTemplate.containsKey(templateName), equalTo(true));
|
||||
var templateIssues = (List<?>) issuesByTemplate.get(templateName);
|
||||
assertThat(((Map<?, ?>) templateIssues.getFirst()).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
|
||||
var templateIssue = (Map<?, ?>) ((List<?>) issuesByTemplate.get(templateName)).getFirst();
|
||||
// Bwc compatible logic until backports are complete.
|
||||
if (templateIssue.containsKey("details")) {
|
||||
assertThat(templateIssue.get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
|
||||
assertThat(templateIssue.get("details"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
|
||||
} else {
|
||||
assertThat(templateIssue.get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ public class SourceFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static final String LOSSY_PARAMETERS_ALLOWED_SETTING_NAME = "index.lossy.source-mapping-parameters";
|
||||
|
||||
public static final String DEPRECATION_WARNING_TITLE = "Configuring source mode in mappings is deprecated.";
|
||||
|
||||
public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated and will be removed "
|
||||
+ "in future versions. Use [index.mapping.source.mode] index setting instead.";
|
||||
|
||||
|
|
|
@ -122,9 +122,9 @@ public class TemplateDeprecationChecker implements ResourceDeprecationChecker {
|
|||
if (sourceMap.containsKey("mode")) {
|
||||
return new DeprecationIssue(
|
||||
DeprecationIssue.Level.CRITICAL,
|
||||
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
|
||||
"https://ela.st/migrate-source-mode",
|
||||
SourceFieldMapper.DEPRECATION_WARNING,
|
||||
"https://github.com/elastic/elasticsearch/pull/117172",
|
||||
null,
|
||||
false,
|
||||
null
|
||||
);
|
||||
|
|
|
@ -51,9 +51,9 @@ public class TemplateDeprecationCheckerTests extends ESTestCase {
|
|||
Map<String, List<DeprecationIssue>> issuesByComponentTemplate = checker.check(clusterState);
|
||||
final DeprecationIssue expected = new DeprecationIssue(
|
||||
DeprecationIssue.Level.CRITICAL,
|
||||
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
|
||||
"https://ela.st/migrate-source-mode",
|
||||
SourceFieldMapper.DEPRECATION_WARNING,
|
||||
"https://github.com/elastic/elasticsearch/pull/117172",
|
||||
null,
|
||||
false,
|
||||
null
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue