diff --git a/server/src/main/java/org/elasticsearch/common/settings/Setting.java b/server/src/main/java/org/elasticsearch/common/settings/Setting.java index 95791406a1fd2..b3e95ee38d849 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/Setting.java +++ b/server/src/main/java/org/elasticsearch/common/settings/Setting.java @@ -1073,6 +1073,11 @@ public static Setting simpleString(String key, Validator validat return new Setting<>(new SimpleKey(key), null, s -> "", Function.identity(), validator, properties); } + public static Setting simpleString(String key, String defaultValue, Validator validator, Property... properties) { + validator.validate(defaultValue); + return new Setting<>(new SimpleKey(key), null, s -> defaultValue, Function.identity(), validator, properties); + } + public static Setting simpleString(String key, Setting fallback, Property... properties) { return simpleString(key, fallback, Function.identity(), properties); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java index 6fea7cf877373..333506f20be35 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java @@ -38,7 +38,10 @@ public class LifecycleSettings { public static final Setting SLM_HISTORY_INDEX_ENABLED_SETTING = Setting.boolSetting(SLM_HISTORY_INDEX_ENABLED, true, Setting.Property.NodeScope); - public static final Setting SLM_RETENTION_SCHEDULE_SETTING = Setting.simpleString(SLM_RETENTION_SCHEDULE, str -> { + public static final Setting SLM_RETENTION_SCHEDULE_SETTING = Setting.simpleString(SLM_RETENTION_SCHEDULE, + // Default to 1:30am every day + "0 30 1 * * ?", + str -> { try { if (Strings.hasText(str)) { // Test that the setting is a valid cron syntax