I am deploying an embedded version of ES in a web application, where there
is one data node created. If I start up another instance of the web
application, another data node is created for that instance and both data
nodes will cluster.
I have a cron job which will kick off periodically in the same JVM (but
potentially different classloader) which will need to access the ES cluster.
The job will instantiate, establish a connection to ES, read/write, then
terminate. My Cron job will have no way to ask the esServer for a client,
nor will it have access to the elasticsearch.properties which was used to
configure the server.
I imagine that some settings (like the name of the cluster) are imperatives,
but I am trying to configure this node with as little information as
possible so there isn't a lot of effort syncing settings between the ES data
node and this node. Since it isn't a data node, I am assuming that settings
related to mappings, index storage, and others are not applicable.
It seems like a TransportClient might be the best approach since it doesn't
require configuration and 'localhost:9300' should always point to the local
var client = new TransportClient().addTransportAddress(new
So what is the most effective way to connect to an existing data node when
you are on the same JVM, but may be in a different classloader?