# Embedded client loading elasticsearch.yml from empty file

**URL:** <https://discuss.elastic.co/t/embedded-client-loading-elasticsearch-yml-from-empty-file/3493>\
**Category:** Elasticsearch\
**Created:** [October 31, 2010, 2:58am UTC](https://discuss.elastic.co/t/embedded-client-loading-elasticsearch-yml-from-empty-file/3493 "2010-10-31T02:58:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Gavarini](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sebastian\_Gavarini](https://discuss.elastic.co/u/Sebastian_Gavarini)\
**Post date:** [October 31, 2010, 2:58am UTC](https://discuss.elastic.co/t/embedded-client-loading-elasticsearch-yml-from-empty-file/3493/1 "2010-10-31T02:58:41Z")

</div>

Hi,  
I am using the embedded node from java:  
node = NodeBuilder.nodeBuilder()  
.client(true)  
.loadConfigSettings(true)  
.node();  
That way I plan to use a non-data node just for routing the queries,  
with data being held in remote ones.

For configuring that node I use a file elasticsearch.yml in a source  
folder, say: src/main/elasticsearch/config/elasticsearch.yml  
src/main/elasticsearch is in the classpath, so I expected the config/  
prefix would be added and found as the docs in NodeBuilder say.

The problem is that it never gets a chance to load, because  
Environment, line 152, loads the empty "elasticsearch.yml" bundled  
with elasticsearch-0.12.1.jar and don't continue with the following  
attempts to load.

If I move the file so no config/ needs to be prefixed, it works fine.  
It's a small problem, but fixing it could save someone else some  
debugging time. Just some ideas, maybe inverting the check for config/  
with /, Environment lines 152-162, but I'm not sure if it has further  
impact. Other option would be to remove the empty config file, or if  
the empty config file is detected, attempt to load config/ too.

Thanks,  
Sebastian.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 31, 2010, 8:51am UTC](https://discuss.elastic.co/t/embedded-client-loading-elasticsearch-yml-from-empty-file/3493/2 "2010-10-31T08:51:13Z")

</div>

Make sense, I have removed the inclusion of the configuration file in the  
jar file, and pushed it to master.

cheers,  
-shay.banon

On Sun, Oct 31, 2010 at 4:58 AM, Sebastian [sgavarini@gmail.com](mailto:sgavarini@gmail.com) wrote:

> Hi,  
> I am using the embedded node from java:  
> node = NodeBuilder.nodeBuilder()  
> .client(true)  
> .loadConfigSettings(true)  
> .node();  
> That way I plan to use a non-data node just for routing the queries,  
> with data being held in remote ones.
> 
> For configuring that node I use a file elasticsearch.yml in a source  
> folder, say: src/main/elasticsearch/config/elasticsearch.yml  
> src/main/elasticsearch is in the classpath, so I expected the config/  
> prefix would be added and found as the docs in NodeBuilder say.
> 
> The problem is that it never gets a chance to load, because  
> Environment, line 152, loads the empty "elasticsearch.yml" bundled  
> with elasticsearch-0.12.1.jar and don't continue with the following  
> attempts to load.
> 
> If I move the file so no config/ needs to be prefixed, it works fine.  
> It's a small problem, but fixing it could save someone else some  
> debugging time. Just some ideas, maybe inverting the check for config/  
> with /, Environment lines 152-162, but I'm not sure if it has further  
> impact. Other option would be to remove the empty config file, or if  
> the empty config file is detected, attempt to load config/ too.
> 
> Thanks,  
> Sebastian.

---

<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 6, 2017, 4:17am UTC](https://discuss.elastic.co/t/embedded-client-loading-elasticsearch-yml-from-empty-file/3493/3 "2017-07-06T04:17:24Z")

</div>


