# Custom Settings for a plugin

**URL:** <https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265>\
**Category:** Elasticsearch\
**Created:** [November 5, 2013, 2:58pm UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265 "2013-11-05T14:58:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Conlin](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mark\_Conlin](https://discuss.elastic.co/u/Mark_Conlin)\
**Post date:** [November 5, 2013, 2:58pm UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265/1 "2013-11-05T14:58:31Z")

</div>

How should I implement custom settings (that I wish to persist across node  
restarts) inside my plugin?  
I will make endpoints to update and view those values, I am just not sure  
of the appropriate usage of Settings to ensure those values get stored  
somewhere.

Thanks,  
Mark

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Mark\_Conlin](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mark\_Conlin](https://discuss.elastic.co/u/Mark_Conlin)\
**Post date:** [November 5, 2013, 4:26pm UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265/2 "2013-11-05T16:26:16Z")

</div>

What I have tried so far:

I have added an UpdateSettingsRestAction that extends BaseRestHandler.

In the handleRequest I attempted this:

public void handleRequest(final RestRequest request, final RestChannelchannel  
) {

```
    UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(

```

Strings.splitStringByCommaToArray(request.param("index")));  
updateSettingsRequest.listenerThreaded(false);  
Settings settings = ImmutableSettings.settingsBuilder().put(  
"test.chicken", true).build();  
updateSettingsRequest.settings(settings);  
client.admin().indices().updateSettings(updateSettingsRequest, new  
AcknowledgedRestResponseActionListener(request,channel  
, logger));  
}

This throws the following error:

ElasticSearchIllegalArgumentException[Can't update non dynamic  
settings[[index.test.chicken]] for open indices[[querycache\_test\_index]]]"

So clearly I can't just slap extra data into the settings for my indices,  
although that is exactly what I would _like_ to do.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [November 5, 2013, 8:05pm UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265/3 "2013-11-05T20:05:31Z")

</div>

You have to register your dynamic cluster setting parameter name in order  
to get it validated as proper input.

Example:

```
public void onModule(ClusterDynamicSettingsModule module) {

```

module.addDynamicSettings(KnapsackService.EXPORT\_STATE\_SETTING\_NAME);

module.addDynamicSettings(KnapsackService.IMPORT\_STATE\_SETTING\_NAME);  
}

For an example how this works, see the usage of this feature in my Knapsack  
plugin:

[https://github.com/jprante/elasticsearch-knapsack/blob/master/src/main/java/org/xbib/elasticsearch/knapsack/KnapsackPlugin.java#L44](https://github.com/jprante/elasticsearch-knapsack/blob/master/src/main/java/org/xbib/elasticsearch/knapsack/KnapsackPlugin.java#L44)

> <https://github.com/jprante/elasticsearch-knapsack/blob/master/src/main/java/org/xbib/elasticsearch/knapsack/KnapsackService.java>

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Mark\_Conlin](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mark\_Conlin](https://discuss.elastic.co/u/Mark_Conlin)\
**Post date:** [November 5, 2013, 8:56pm UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265/4 "2013-11-05T20:56:53Z")

</div>

Perfect. That does in fact work.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:08am UTC](https://discuss.elastic.co/t/custom-settings-for-a-plugin/14265/5 "2017-07-06T02:08:41Z")

</div>


