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

Elasticsearch 5: Avoid adding path.home if not set

If path.home is not set we should not add it to the settings object used
to construct the transport client otherwise we will hit a null pointer
exception due to the null value being dereferenced in the internals of
Elasticsearch.
parent b1e1d480
No related branches found
No related tags found
No related merge requests found
......@@ -87,9 +87,10 @@ public class ElasticsearchClient extends DB {
int numberOfReplicas = parseIntegerProperty(props, "es.number_of_replicas", NUMBER_OF_REPLICAS);
Boolean newdb = Boolean.parseBoolean(props.getProperty("es.newdb", "false"));
Builder settings = Settings.builder()
.put("cluster.name", DEFAULT_CLUSTER_NAME)
.put("path.home", pathHome);
Builder settings = Settings.builder().put("cluster.name", DEFAULT_CLUSTER_NAME);
if (pathHome != null) {
settings.put("path.home", pathHome);
}
// if properties file contains elasticsearch user defined properties
// add it to the settings file (will overwrite the defaults).
......
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