Connect to bonsai.io with elasticsearch java client?

Hi, I'm just getting started with elasticsearch and I'm using bonsai.io. I
have no problems getting starting using bonsai.io using curl.

Now I'm trying to connect using the elasticsearch java client. Anyone else
doing this yet?

Here is the code:
TransportClient client = new
TransportClient().addTransportAddress(new
InetSocketTransportAddress("index.bonsai.io", 80));

I get this error message:
19:46:36,706 INFO transport:109 - [White Tiger] failed to get node info
for [#transport#-1][inet[index.bonsai.io/23.21.92.230:80]], disconnecting...
org.elasticsearch.transport.NodeDisconnectedException:
[][inet[index.bonsai.io/23.21.92.230:80]][cluster/nodes/info] disconnected

Any insight?

Thanks
George

On Thursday, July 12, 2012, George Su wrote:

Hi, I'm just getting started with elasticsearch and I'm using bonsai.io.
I have no problems getting starting using bonsai.io using curl.

Now I'm trying to connect using the elasticsearch java client. Anyone else
doing this yet?

Here is the code:
TransportClient client = new
TransportClient().addTransportAddress(new InetSocketTransportAddress("
index.bonsai.io", 80));

I get this error message:
19:46:36,706 INFO transport:109 - [White Tiger] failed to get node info
for [#transport#-1][inet[index.bonsai.io/23.21.92.230:80]http://index.bonsai.io/23.21.92.230:80]],
disconnecting...
org.elasticsearch.transport.NodeDisconnectedException: [inet[
index.bonsai.io/23.21.92.230:80]][cluster/nodes/infohttp://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info]
disconnected

Try port 9300 instead of 80.

--
-Drew

Duh, of course I should have tried that. Port 9300 worked. I totally spaced
because I was using curl for testing and assumed it would always be port
80. Thanks!

Now I need to figure out why the Get doesn't work:

    GetResponse response = client.prepareGet(index, type, 

id).execute().actionGet();

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
at
org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:97)
at
org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:171)
at
org.elasticsearch.client.transport.TransportClient.get(TransportClient.java:348)
at
org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:135)
at
org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:53)
at
org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:47)
...

On Thursday, July 12, 2012 9:20:50 PM UTC-7, Drew Raines wrote:

On Thursday, July 12, 2012, George Su wrote:

Hi, I'm just getting started with elasticsearch and I'm using bonsai.io.
I have no problems getting starting using bonsai.io using curl.

Now I'm trying to connect using the elasticsearch java client. Anyone
else doing this yet?

Here is the code:
TransportClient client = new
TransportClient().addTransportAddress(new InetSocketTransportAddress("
index.bonsai.io", 80));

I get this error message:
19:46:36,706 INFO transport:109 - [White Tiger] failed to get node info
for [#transport#-1][inet[index.bonsai.io/23.21.92.230:80]http://index.bonsai.io/23.21.92.230:80]],
disconnecting...
org.elasticsearch.transport.NodeDisconnectedException: [inet[
index.bonsai.io/23.21.92.230:80]][cluster/nodes/infohttp://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info]
disconnected

Try port 9300 instead of 80.

--
-Drew

That suggests to me you aren't setting a cluster name in your client and it
can't find the master.

-Drew

On Friday, July 13, 2012, George Su wrote:

Duh, of course I should have tried that. Port 9300 worked. I totally
spaced because I was using curl for testing and assumed it would always be
port 80. Thanks!

Now I need to figure out why the Get doesn't work:

    GetResponse response = client.prepareGet(index, type,

id).execute().actionGet();

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
at
org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:97)
at
org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:171)
at
org.elasticsearch.client.transport.TransportClient.get(TransportClient.java:348)
at
org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:135)
at
org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:53)
at
org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:47)
...

On Thursday, July 12, 2012 9:20:50 PM UTC-7, Drew Raines wrote:

On Thursday, July 12, 2012, George Su wrote:

Hi, I'm just getting started with elasticsearch and I'm using bonsai.io.
I have no problems getting starting using bonsai.io using curl.

Now I'm trying to connect using the elasticsearch java client. Anyone
else doing this yet?

Here is the code:
TransportClient client = new TransportClient().addTransportAddress(new
InetSocketTransportAddress("in
dex.bonsai.io http://index.bonsai.io",
80));

I get this error message:
19:46:36,706 INFO transport:109 - [White Tiger] failed to get node info
for [#transport#-1][inet[index.**bonsai.io/23.21.92.230:80]http://index.bonsai.io/23.21.92.230:80]],
disconnecting...
org.elasticsearch.transport.**NodeDisconnectedException: [inet[
index.bonsai.io/23.21.**92.230:80]][cluster/nodes/infohttp://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info
**] disconnected

Try port 9300 instead of 80.

--
-Drew

--
-Drew

Thanks to Nick at onemorecloud I found out this java client is not
supported on bonsai.io.

"At this time we're only planning to support ElasticSearch's HTTP API,
which is unfortunately completely different than the direction you've been
going here. The Java API you've linked is for creating an ElasticSearch
Node that's joined to the cluster using a lower-level TCP protocol."

So for now I'll switch to making json calls over http.