Embedded client loading elasticsearch.yml from empty file


(Sebastian Gavarini) #1

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.


(Shay Banon) #2

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 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.


(system) #3