How to set cluster name on Transport Client

Hi

I am having problems connecting to the ES cluster using the java api
TransportClient, as soon as I configured the ES servers using a
cluster.name. I am guessing my TransportClient is looking for the
cluster with name "elasticsearch". So my question is, how do I set the
cluster name on TransportClient. I know NodeBuilder has a method
clusterName(), but did not see anything similar for TransportClient.

My ES configuration loos like this. Btw, I am running the latest trunk
build of ES.

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs

The stacktrace from my application here:

STAGE:[2010-11-10 14:57:16,779][DEBUG]
[com.bamnetworks.cms.search.ItemSearchService] Default item search
STAGE:[2010-11-10 14:57:16,839][DEBUG]
[com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]
org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3
STAGE:[2010-11-10 14:57:16,995][ERROR]
[com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error
getting ItemSearchRequest{ Request{ index='hb-stage'}
searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}
org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:
138)
at
org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:
232)
at
org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:
290)
at
org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:
413)
at
org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
56)
at
org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
51)
at
com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:
32)

Thanks
Diptamay

You need to pass settings to the TransportClient, and set cluser.name to you
cluster name. Use the ImmutableSettings builder to create it.

On Wed, Nov 10, 2010 at 10:15 PM, diptamay diptamay@gmail.com wrote:

Hi

I am having problems connecting to the ES cluster using the java api
TransportClient, as soon as I configured the ES servers using a
cluster.name. I am guessing my TransportClient is looking for the
cluster with name "elasticsearch". So my question is, how do I set the
cluster name on TransportClient. I know NodeBuilder has a method
clusterName(), but did not see anything similar for TransportClient.

My ES configuration loos like this. Btw, I am running the latest trunk
build of ES.

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs

The stacktrace from my application here:

STAGE:[2010-11-10 14:57:16,779][DEBUG]
[com.bamnetworks.cms.search.ItemSearchService] Default item search
STAGE:[2010-11-10 14:57:16,839][DEBUG]

[com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]
org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3
STAGE:[2010-11-10 14:57:16,995][ERROR]
[com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error
getting ItemSearchRequest{ Request{ index='hb-stage'}
searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}
org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at

org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:
138)
at

org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:
232)
at

org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:
290)
at

org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:
413)
at

org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
56)
at

org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
51)
at

com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:
32)

Thanks
Diptamay

Thanks. That worked for me.

On Nov 10, 5:58 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

You need to pass settings to the TransportClient, and set cluser.name to you
cluster name. Use the ImmutableSettings builder to create it.

On Wed, Nov 10, 2010 at 10:15 PM, diptamay dipta...@gmail.com wrote:

Hi

I am having problems connecting to the ES cluster using the java api
TransportClient, as soon as I configured the ES servers using a
cluster.name. I am guessing my TransportClient is looking for the
cluster with name "elasticsearch". So my question is, how do I set the
cluster name on TransportClient. I know NodeBuilder has a method
clusterName(), but did not see anything similar for TransportClient.

My ES configuration loos like this. Btw, I am running the latest trunk
build of ES.

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs

The stacktrace from my application here:

STAGE:[2010-11-10 14:57:16,779][DEBUG]
[com.bamnetworks.cms.search.ItemSearchService] Default item search
STAGE:[2010-11-10 14:57:16,839][DEBUG]

[com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]
org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3
STAGE:[2010-11-10 14:57:16,995][ERROR]
[com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error
getting ItemSearchRequest{ Request{ index='hb-stage'}
searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}
org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at

org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:
138)
at

org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:
232)
at

org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:
290)
at

org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:
413)
at

org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
56)
at

org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:
51)
at

com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:
32)

Thanks
Diptamay