I'm currently migrating a product from Elasticsearch 1.7 to 2.1.
We use the Java node client to setup a standalone server or communicate with a remote one.
When trying to setup the node instance, we use the procedure of creating a node from the builder which reads the file elasticsearch.yml from the classpath (located in src/main/resources):
Node node = NodeBuilder.nodeBuilder().node();
In 1.7 this code loads the information from elasticsearch.yml, properly. This is also mentioned in the documentation of the Java client for 2.1: Node Client
Yet, this code snippet does not work for 2.1 .
I either get an error message that the entry
path.home is missing (which is present in the file).
Using the debugger I see that the entries from the file are not read and the initialization stops during the construction of the
Environment object and prints the respective error message.
If I specify the file from the classpath to be loaded, manually, everything works fine.
In 1.7 we used an override mechanism by using the standard ways, Elasticsearch provided to us. That means that multiple
elasticsearch.yml files could be provided. The one lying outside the shaded jar could thus override the internal settings. If no external settings were provided, the defaults from inside the jar file/classpath were used.
This is a procedure which we would like to keep as it is really convenient.
Yet, we don't know how to use this setup in version 2.1 as our previous approaches did not succeed.
Could anyone of You please provide us hints regarding this issue?
Thanks in advance.