Regsitering cluster settings from Plugin

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);

Ignore my question. I had to override method getSettings in Plugin class. That's all :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.