# Java Client YAML configuration

**URL:** <https://discuss.elastic.co/t/java-client-yaml-configuration/37207>\
**Category:** Elasticsearch\
**Created:** [December 15, 2015, 8:32am UTC](https://discuss.elastic.co/t/java-client-yaml-configuration/37207 "2015-12-15T08:32:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vorden](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@vorden](https://discuss.elastic.co/u/vorden)\
**Post date:** [December 15, 2015, 8:32am UTC](https://discuss.elastic.co/t/java-client-yaml-configuration/37207/1 "2015-12-15T08:32:47Z")

</div>

Hi everyone,

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](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/node-client.html)  
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.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [December 15, 2015, 9:25am UTC](https://discuss.elastic.co/t/java-client-yaml-configuration/37207/2 "2015-12-15T09:25:20Z")

</div>

Hi,

it seems like allowing multiple configuration files was removed by [https://github.com/elastic/elasticsearch/pull/13039](https://github.com/elastic/elasticsearch/pull/13039), see discussion in the ticket for various reasons. So I think loading the settings manually now seems to be the prefered way. I wonder if the node client docs need an update though.

---

<div class="post-metadata">

**Author:** ![vorden](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@vorden](https://discuss.elastic.co/u/vorden)\
**Post date:** [December 15, 2015, 9:29am UTC](https://discuss.elastic.co/t/java-client-yaml-configuration/37207/3 "2015-12-15T09:29:41Z")

</div>

Hi,  
thanks for the quick reply. This answers one part of my question.  
The other one is regarding the "auto configuration" from classpath.  
This does not seem to be still working, in this case.  
Actually, it is not a big problem to specify the configuration file, manually, but according the docs (which might need an update as You stated), the code `NodeBuilder.nodeBuilder().node()` should take the `elasticsearch.yml` from the classpath into account which it obviously is taking in my case.  
Is this a configuration error on my side or is this not supported any more as of the change given in Your reply?

Best regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:30pm UTC](https://discuss.elastic.co/t/java-client-yaml-configuration/37207/4 "2017-07-05T23:30:59Z")

</div>


