# Regsitering cluster settings from Plugin

**URL:** <https://discuss.elastic.co/t/regsitering-cluster-settings-from-plugin/81332>\
**Category:** Elasticsearch\
**Created:** [April 5, 2017, 3:42pm UTC](https://discuss.elastic.co/t/regsitering-cluster-settings-from-plugin/81332 "2017-04-05T15:42:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pawel\_Rog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pawel_rog/32/141223_2.png) [@Pawel\_Rog](https://discuss.elastic.co/u/Pawel_Rog)\
**Post date:** [April 5, 2017, 3:42pm UTC](https://discuss.elastic.co/t/regsitering-cluster-settings-from-plugin/81332/1 "2017-04-05T15:42:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pawel\_Rog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pawel_rog/32/141223_2.png) [@Pawel\_Rog](https://discuss.elastic.co/u/Pawel_Rog)\
**Post date:** [April 5, 2017, 7:51pm UTC](https://discuss.elastic.co/t/regsitering-cluster-settings-from-plugin/81332/2 "2017-04-05T19:51:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 3, 2017, 7:51pm UTC](https://discuss.elastic.co/t/regsitering-cluster-settings-from-plugin/81332/3 "2017-05-03T19:51:51Z")

</div>

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