Skip to content
Snippets Groups Projects
Commit 23163cc1 authored by Jason Tedor's avatar Jason Tedor
Browse files

Elasticsearch 5: Fix handling of settings

Since Elasticsearch 5, Elasticsearch is now strict about settings. This
means that if you pass it a setting that it does not recognize,
Elasticsearch will throw an exception whereas previously it was lenient
in such situations. This commit removes passing all properties as
settings to Elasticsearch in favor of a special prefix es.setting for
which properties prefixed with this will be passed as settings to
Elasticsearch.
parent a3ba64d5
No related branches found
No related tags found
No related merge requests found
......@@ -94,7 +94,14 @@ public class ElasticsearchClient extends DB {
// if properties file contains elasticsearch user defined properties
// add it to the settings file (will overwrite the defaults).
settings.put(props);
for (final Entry<Object, Object> e : props.entrySet()) {
if (e.getKey() instanceof String) {
final String key = (String) e.getKey();
if (key.startsWith("es.setting.")) {
settings.put(key.substring("es.setting.".length()), e.getValue());
}
}
}
final String clusterName = settings.get("cluster.name");
System.err.println("Elasticsearch starting node = " + clusterName);
System.err.println("Elasticsearch node path.home = " + settings.get("path.home"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment