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 .
jprante
(Jörg Prante)
November 5, 2013, 8:05pm
3
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
/*
* Copyright (C) 2014 Jörg Prante
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xbib.elasticsearch.knapsack;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
This file has been truncated. show original
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 .