2
votes

I am new to elasticsearch and trying to connect to a remote cluster running version 1.5.2. I have added the same version Maven dependency to my project. I am initializing the Transport client using the following Scala code:

val settings: Settings = ImmutableSettings.settingsBuilder().put("cluster.name", "clusterName").put("client.transport.sniff", true).build()
val client: Client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("XX.X.X.XX", 9300))

It then fails when i try to check if an index exists:

val exists = client.admin().indices().prepareExists("index").execute().actionGet().isExists()

"clusterName" matches the property 'cluster.name' in the elasticsearch.yml on the cluster. I have also tried upping the client.transport.ping_timeout and client.transport.nodes_sampler_interval to 30s to no avail and tried both with and without sniffing.

I have used curl on port 9200 to verify that i can index and search on my elasticsearch instance.

Relevant Stack trace:

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305)
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200)
    at org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:86)
    at org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:170)
    at org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:53)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

Thanks in advance for any assistance.

1
hey, I had the exact same issue... took me almost an hour to figure out that my configuration was overriden by a deprecated elasticsearch.yml on my classpath ;D - klamann

1 Answers

0
votes

I know this is very old question but one workaround I know for this situation is to add sniffing to false in your settings

put("client.transport.sniff", false)