How to specify where to find elasticsearch.yml for TransportClient?


(Tim Bessie) #1

I want to specify where TransportClient can find elasticsearch.yml - from what I can see, the documentation on Java clients doesn't talk much about it, except to say:

You can define cluster.name in the /src/main/resources/elasticsearch.yml file in your project. As long as elasticsearch.yml is present in the classpath, it will be used when you start your node.

I'm not building with Maven, just using eclipse and we don't use the above source hierarchy style. A forum discussion says one can put elasticsearch.yml "in /" but that's as much as I've found.

Is there a complete discussion of where I can put elasticsearch.yml for client-side code to find it? Can I specify it programmatically? What are the options? Links to documentation on that subject?

  • Tim

(Jason Wee) #2

hey tim,

will this help ? https://github.com/elastic/elasticsearch/blob/master/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java#L38


(Tim Bessie) #3

That's helpful, yes, thanks!

I also realized that I was already setting the client's location for elasticsearch.yml through setting it as a system property, thus:

System.setProperty("es.config", "[path-to-elasticsearch.ytml]");

So... d'oh! :smile:

  • Tim

(system) #4