private Settings toDynamicSettings(Settings settings) {
// FIXME TransportClient?
InternalNode node = (InternalNode) ((NodeClient) getClient()).getNode();
DynamicSettings indexDynamicSettings = node.injector().getInstance(DynamicSettingsBean.class)
.getIndexDynamicSettings();
ImmutableSettings.Builder dynamicSettings = ImmutableSettings.builder();
for (Map.Entry<String, String> e : settings.getAsMap().entrySet()) {
if (indexDynamicSettings.hasDynamicSetting(e.getKey())) {
String error = indexDynamicSettings.validateDynamicSetting(e.getKey(), e.getValue());
if (error == null) {
dynamicSettings.put(e.getKey(), e.getValue());
} else {
// TODO better error handling
throw new IllegalArgumentException("index setting " + e.getKey() + " has invalid value '"