# Connect to bonsai.io with elasticsearch java client?

**URL:** <https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403>\
**Category:** Elasticsearch\
**Created:** [July 13, 2012, 2:48am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403 "2012-07-13T02:48:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![George\_Su](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@George\_Su](https://discuss.elastic.co/u/George_Su)\
**Post date:** [July 13, 2012, 2:48am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/1 "2012-07-13T02:48:15Z")

</div>

Hi, I'm just getting started with elasticsearch and I'm using [bonsai.io](http://bonsai.io). I  
have no problems getting starting using [bonsai.io](http://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](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](http://index.bonsai.io/23.21.92.230:80)]][cluster/nodes/info] disconnected

Any insight?

Thanks  
George

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [July 13, 2012, 4:20am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/2 "2012-07-13T04:20:50Z")

</div>

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

> Hi, I'm just getting started with elasticsearch and I'm using [bonsai.io](http://bonsai.io).  
> I have no problems getting starting using [bonsai.io](http://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](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)][http://index.bonsai.io/23.21.92.230:80]](http://index.bonsai.io/23.21.92.230:80%5D)],  
> disconnecting...  
> org.elasticsearch.transport.NodeDisconnectedException: [inet[  
> [index.bonsai.io/23.21.92.230:80](http://index.bonsai.io/23.21.92.230:80)]][cluster/nodes/info[http://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info](http://index.bonsai.io/23.21.92.230:80%5D%5D%5Bcluster/nodes/info)]  
> disconnected

Try port 9300 instead of 80.

--  
-Drew

---

<div class="post-metadata">

**Author:** ![George\_Su](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@George\_Su](https://discuss.elastic.co/u/George_Su)\
**Post date:** [July 13, 2012, 5:04am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/3 "2012-07-13T05:04:56Z")

</div>

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](http://bonsai.io).  
> > I have no problems getting starting using [bonsai.io](http://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](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)][http://index.bonsai.io/23.21.92.230:80]](http://index.bonsai.io/23.21.92.230:80%5D)],  
> > disconnecting...  
> > org.elasticsearch.transport.NodeDisconnectedException: [inet[  
> > [index.bonsai.io/23.21.92.230:80](http://index.bonsai.io/23.21.92.230:80)]][cluster/nodes/info[http://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info](http://index.bonsai.io/23.21.92.230:80%5D%5D%5Bcluster/nodes/info)]  
> > disconnected
> 
> Try port 9300 instead of 80.
> 
> --  
> -Drew

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [July 13, 2012, 5:14am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/4 "2012-07-13T05:14:58Z")

</div>

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](http://bonsai.io).  
> > > I have no problems getting starting using [bonsai.io](http://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://dex.bonsai.io) [http://index.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://bonsai.io/23.21.92.230:80)][http://index.bonsai.io/23.21.92.230:80]](http://index.bonsai.io/23.21.92.230:80%5D)],  
> > > disconnecting...  
> > > org.elasticsearch.transport.\*\*NodeDisconnectedException: [inet[  
> > > [index.bonsai.io/23.21.\*\*92.230:80](http://index.bonsai.io/23.21.**92.230:80)]][cluster/nodes/info[http://index.bonsai.io/23.21.92.230:80]][cluster/nodes/info](http://index.bonsai.io/23.21.92.230:80%5D%5D%5Bcluster/nodes/info)  
> > > \*\*] disconnected
> > 
> > Try port 9300 instead of 80.
> > 
> > --  
> > -Drew

--  
-Drew

---

<div class="post-metadata">

**Author:** ![George\_Su](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@George\_Su](https://discuss.elastic.co/u/George_Su)\
**Post date:** [July 13, 2012, 5:58am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/5 "2012-07-13T05:58:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:20am UTC](https://discuss.elastic.co/t/connect-to-bonsai-io-with-elasticsearch-java-client/8403/6 "2017-07-06T03:20:26Z")

</div>


