# Elasticsearch plugin custom settings

**URL:** <https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262>\
**Category:** Elasticsearch\
**Created:** [October 26, 2018, 11:35pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262 "2018-10-26T23:35:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiboxiv](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jiboxiv](https://discuss.elastic.co/u/jiboxiv)\
**Post date:** [October 26, 2018, 11:35pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262/1 "2018-10-26T23:35:01Z")

</div>

Hi,

I wish to create an Elasticsearch plugin, this plugin requires some settings to be stored and to be mutable. I have found in some threads using the onModule() function. But this does not seem to exist in the 6.2 plugin.

Could someone provide me with more information about how to add settings to cluster / make them mutable, or even better provide me with an example?

Thanks!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 27, 2018, 12:44am UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262/2 "2018-10-27T00:44:31Z")

</div>

Not sure if this is what you want but look at

> <https://github.com/elastic/elasticsearch/blob/master/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageClientSettings.java>

And

> <https://github.com/elastic/elasticsearch/blob/master/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePlugin.java>

---

<div class="post-metadata">

**Author:** ![jiboxiv](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jiboxiv](https://discuss.elastic.co/u/jiboxiv)\
**Post date:** [October 29, 2018, 8:35pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262/3 "2018-10-29T20:35:04Z")

</div>

Hi David,

This looks helpful, but I don't see / understand how these settings will become mutable?

A basic example is foo.bar.baz.enabled = true

I want to be able to set this flag to false. I don't see anywhere in your code where you allow for such a thing?

Thanks!

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [October 29, 2018, 9:15pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262/4 "2018-10-29T21:15:18Z")

</div>

Take a look at the [example custom settings plugin](https://github.com/elastic/elasticsearch/tree/master/plugins/examples/custom-settings). In particular, you want a Setting object created with the `Property.Dynamic`. You will also most likely want to have your plugin depend on the `ClusterService`, and call `clusterService.getClusterSettings().addSettingsUpdateConsumer` to get notified when the setting changes (assuming the setting is cluster wide).

---

<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:** [November 26, 2018, 9:15pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-custom-settings/154262/5 "2018-11-26T21:15:54Z")

</div>

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