Custom Settings for a plugin

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.
For more options, visit https://groups.google.com/groups/opt_out.

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.
For more options, visit https://groups.google.com/groups/opt_out.

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

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.
For more options, visit https://groups.google.com/groups/opt_out.

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.
For more options, visit https://groups.google.com/groups/opt_out.