In ES 2.x I could register cluster level setting by calling clusterModule.registerClusterDynamicSetting inside Plugin. I cannot do this in ES 5.x because dynamic settings have changed.
How can I register setting in Plugin? I get java.lang.IllegalArgumentException: Setting is not registered for key
when calling clusterSettings.addSettingsUpdateConsumer
.
public static final Setting<String[]> CUSTOM_SETTING =
new Setting<>("cluster.custom_setting", "", s -> Strings.tokenizeToStringArray(s, ","),
Property.Dynamic,
Property.NodeScope);
... and in constructor ....
this.customSetting = CUSTOM_SETTING.get(settings);
clusterSettings.addSettingsUpdateConsumer(CUSTOM_SETTING, this::setCustomAttributes);