# New to elastic search

**URL:** <https://discuss.elastic.co/t/new-to-elastic-search/2892>\
**Category:** Elasticsearch\
**Created:** [April 5, 2010, 9:07pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892 "2010-04-05T21:07:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![megAmin](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@megAmin](https://discuss.elastic.co/u/megAmin)\
**Post date:** [April 5, 2010, 9:07pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/1 "2010-04-05T21:07:47Z")

</div>

hello  
i am new to elastic search. i read thru java api on your site but  
cudnt understand completely how to create client by establishing  
connection to the server. elastic search server is hosted at a  
particular IP address and i need to connect to it thru java code. so  
can you please guide me as to which kind of client i should create  
and how?

thnx

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 5, 2010, 11:08pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/2 "2010-04-05T23:08:44Z")

</div>

Explained here:  
[http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/). Probably  
the simplest form would be to use the Server Client. Note, if you use it,  
make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.

cheers,  
shay.banon

On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:

> hello  
> i am new to Elasticsearch. i read thru java api on your site but  
> cudnt understand completely how to create client by establishing  
> connection to the server. Elasticsearch server is hosted at a  
> particular IP address and i need to connect to it thru java code. so  
> can you please guide me as to which kind of client i should create  
> and how?
> 
> thnx

---

<div class="post-metadata">

**Author:** ![megAmin](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@megAmin](https://discuss.elastic.co/u/megAmin)\
**Post date:** [April 6, 2010, 12:50pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/3 "2010-04-06T12:50:16Z")

</div>

hey i saw this, but i want the client to talk to my server at a particular  
ip for example 10.0.0.56. so how to make tat happen? which property to set?

On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Explained here:  
> [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/). Probably  
> the simplest form would be to use the Server Client. Note, if you use it,  
> make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> 
> cheers,  
> shay.banon
> 
> On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> 
> > hello  
> > i am new to Elasticsearch. i read thru java api on your site but  
> > cudnt understand completely how to create client by establishing  
> > connection to the server. Elasticsearch server is hosted at a  
> > particular IP address and i need to connect to it thru java code. so  
> > can you please guide me as to which kind of client i should create  
> > and how?
> > 
> > thnx

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 6, 2010, 12:51pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/4 "2010-04-06T12:51:53Z")

</div>

The server client way will automatically discover all the other nodes in the  
cluster. If you don't want that, and want to use direct connection, then you  
can use the TransportClient also explained on the page.

-shay.banon

On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:

> hey i saw this, but i want the client to talk to my server at a particular  
> ip for example 10.0.0.56. so how to make tat happen? which property to set?
> 
> On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > Explained here:  
> > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > Probably the simplest form would be to use the Server Client. Note, if you  
> > use it, make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> > 
> > cheers,  
> > shay.banon
> > 
> > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> > 
> > > hello  
> > > i am new to Elasticsearch. i read thru java api on your site but  
> > > cudnt understand completely how to create client by establishing  
> > > connection to the server. Elasticsearch server is hosted at a  
> > > particular IP address and i need to connect to it thru java code. so  
> > > can you please guide me as to which kind of client i should create  
> > > and how?
> > > 
> > > thnx

---

<div class="post-metadata">

**Author:** ![megAmin](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@megAmin](https://discuss.elastic.co/u/megAmin)\
**Post date:** [April 6, 2010, 12:51pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/5 "2010-04-06T12:51:54Z")

</div>

thnk u for guiding me, i had one more question regarding server  
client, i want the client to talk to my server at a particular ip for  
example 10.0.0.56. so how to make tat happen? which property to set?

On Apr 5, 7:08 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Explained here:[http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/). Probably  
> the simplest form would be to use the Server Client. Note, if you use it,  
> make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> 
> cheers,  
> shay.banon
> 
> On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> 
> > hello  
> > i am new to Elasticsearch. i read thru java api on your site but  
> > cudnt understand completely how to create client by establishing  
> > connection to the server. Elasticsearch server is hosted at a  
> > particular IP address and i need to connect to it thru java code. so  
> > can you please guide me as to which kind of client i should create  
> > and how?
> 
> > thnx

---

<div class="post-metadata">

**Author:** ![megAmin](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@megAmin](https://discuss.elastic.co/u/megAmin)\
**Post date:** [April 6, 2010, 12:55pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/6 "2010-04-06T12:55:11Z")

</div>

yes i tried the transportCLient but my code is getting hosed, it is getting  
stuck at this particular line

Client client2 = new TransportClient()  
.addTransportAddress(new InetSocketTransportAddress("10.0.0.56",  
9200));

ne clues wat i m doing wrong?

On Tue, Apr 6, 2010 at 8:51 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> The server client way will automatically discover all the other nodes in  
> the cluster. If you don't want that, and want to use direct connection, then  
> you can use the TransportClient also explained on the page.
> 
> -shay.banon
> 
> On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> 
> > hey i saw this, but i want the client to talk to my server at a particular  
> > ip for example 10.0.0.56. so how to make tat happen? which property to set?
> > 
> > On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> > 
> > > Explained here:  
> > > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > > Probably the simplest form would be to use the Server Client. Note, if you  
> > > use it, make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> > > 
> > > cheers,  
> > > shay.banon
> > > 
> > > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> > > 
> > > > hello  
> > > > i am new to Elasticsearch. i read thru java api on your site but  
> > > > cudnt understand completely how to create client by establishing  
> > > > connection to the server. Elasticsearch server is hosted at a  
> > > > particular IP address and i need to connect to it thru java code. so  
> > > > can you please guide me as to which kind of client i should create  
> > > > and how?
> > > > 
> > > > thnx

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 6, 2010, 1:02pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/7 "2010-04-06T13:02:37Z")

</div>

You mean its actually getting stuck and does not progress the execution to  
the next line? If so, can you post the thread dump?

cheers,  
shay.banon

On Tue, Apr 6, 2010 at 3:55 PM, megha a [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:

> yes i tried the transportCLient but my code is getting hosed, it is getting  
> stuck at this particular line
> 
> Client client2 = new TransportClient()  
> .addTransportAddress(new InetSocketTransportAddress("10.0.0.56",  
> 9200));
> 
> ne clues wat i m doing wrong?
> 
> On Tue, Apr 6, 2010 at 8:51 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > The server client way will automatically discover all the other nodes in  
> > the cluster. If you don't want that, and want to use direct connection, then  
> > you can use the TransportClient also explained on the page.
> > 
> > -shay.banon
> > 
> > On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> > 
> > > hey i saw this, but i want the client to talk to my server at a  
> > > particular ip for example 10.0.0.56. so how to make tat happen? which  
> > > property to set?
> > > 
> > > On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon \<[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> > > 
> > > > wrote:
> > > 
> > > > Explained here:  
> > > > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > > > Probably the simplest form would be to use the Server Client. Note, if you  
> > > > use it, make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> > > > 
> > > > cheers,  
> > > > shay.banon
> > > > 
> > > > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.megha@gmail.com](mailto:amin.megha@gmail.com) wrote:
> > > > 
> > > > > hello  
> > > > > i am new to Elasticsearch. i read thru java api on your site but  
> > > > > cudnt understand completely how to create client by establishing  
> > > > > connection to the server. Elasticsearch server is hosted at a  
> > > > > particular IP address and i need to connect to it thru java code. so  
> > > > > can you please guide me as to which kind of client i should create  
> > > > > and how?
> > > > > 
> > > > > thnx

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 1:45pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/8 "2010-04-06T13:45:06Z")

</div>

Yes I've seen that too and then abandoned using the Java API.

Are their any examples of the Java API that are complete and connect  
to a remote cluster?

Thanks,

On Apr 6, 9:02 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You mean its actually getting stuck and does not progress the execution to  
> the next line? If so, can you post the thread dump?
> 
> cheers,  
> shay.banon
> 
> On Tue, Apr 6, 2010 at 3:55 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> 
> > yes i tried the transportCLient but my code is getting hosed, it is getting  
> > stuck at this particular line
> 
> > Client client2 = new TransportClient()  
> > .addTransportAddress(new InetSocketTransportAddress("10.0.0.56",  
> > 9200));
> 
> > ne clues wat i m doing wrong?
> 
> > On Tue, Apr 6, 2010 at 8:51 AM, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)wrote:
> 
> > > The server client way will automatically discover all the other nodes in  
> > > the cluster. If you don't want that, and want to use direct connection, then  
> > > you can use the TransportClient also explained on the page.
> 
> > > -shay.banon
> 
> > > On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> 
> > > > hey i saw this, but i want the client to talk to my server at a  
> > > > particular ip for example 10.0.0.56. so how to make tat happen? which  
> > > > property to set?
> 
> > > > On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)
> > > > 
> > > > > wrote:
> 
> > > > > Explained here:  
> > > > > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > > > > Probably the simplest form would be to use the Server Client. Note, if you  
> > > > > use it, make sure to pass -Djava.net.preferIPv4Stack=true for simpler usage.
> 
> > > > > cheers,  
> > > > > shay.banon
> 
> > > > > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> 
> > > > > > hello  
> > > > > > i am new to Elasticsearch. i read thru java api on your site but  
> > > > > > cudnt understand completely how to create client by establishing  
> > > > > > connection to the server. Elasticsearch server is hosted at a  
> > > > > > particular IP address and i need to connect to it thru java code. so  
> > > > > > can you please guide me as to which kind of client i should create  
> > > > > > and how?
> 
> > > > > > thnx

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 6, 2010, 1:46pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/9 "2010-04-06T13:46:37Z")

</div>

I really don't understand what the problem is, its working fine for me. The  
example is what is posted on the doc. If you can provide me with a stack  
trace when things gets stuck on your end, then I can help further.

cheer,  
shay.banon

On Tue, Apr 6, 2010 at 4:45 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:

> Yes I've seen that too and then abandoned using the Java API.
> 
> Are their any examples of the Java API that are complete and connect  
> to a remote cluster?
> 
> Thanks,
> 
> On Apr 6, 9:02 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > You mean its actually getting stuck and does not progress the execution  
> > to  
> > the next line? If so, can you post the thread dump?
> > 
> > cheers,  
> > shay.banon
> > 
> > On Tue, Apr 6, 2010 at 3:55 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> > 
> > > yes i tried the transportCLient but my code is getting hosed, it is  
> > > getting  
> > > stuck at this particular line
> > 
> > > Client client2 = new TransportClient()  
> > > .addTransportAddress(new  
> > > InetSocketTransportAddress("10.0.0.56",  
> > > 9200));
> > 
> > > ne clues wat i m doing wrong?
> > 
> > > On Tue, Apr 6, 2010 at 8:51 AM, Shay Banon \<  
> > > [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)\>wrote:
> > 
> > > > The server client way will automatically discover all the other nodes  
> > > > in  
> > > > the cluster. If you don't want that, and want to use direct  
> > > > connection, then  
> > > > you can use the TransportClient also explained on the page.
> > 
> > > > -shay.banon
> > 
> > > > On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> > 
> > > > > hey i saw this, but i want the client to talk to my server at a  
> > > > > particular ip for example 10.0.0.56. so how to make tat happen? which  
> > > > > property to set?
> > 
> > > > > On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon \<  
> > > > > [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)
> > > > > 
> > > > > > wrote:
> > 
> > > > > > Explained here:  
> > > > > > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > > > > > Probably the simplest form would be to use the Server Client. Note,  
> > > > > > if you  
> > > > > > use it, make sure to pass -Djava.net.preferIPv4Stack=true for  
> > > > > > simpler usage.
> > 
> > > > > > cheers,  
> > > > > > shay.banon
> > 
> > > > > > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.me...@gmail.com](mailto:amin.me...@gmail.com)  
> > > > > > wrote:
> > 
> > > > > > > hello  
> > > > > > > i am new to Elasticsearch. i read thru java api on your site but  
> > > > > > > cudnt understand completely how to create client by establishing  
> > > > > > > connection to the server. Elasticsearch server is hosted at a  
> > > > > > > particular IP address and i need to connect to it thru java code.  
> > > > > > > so  
> > > > > > > can you please guide me as to which kind of client i should create  
> > > > > > > and how?
> > 
> > > > > > > thnx

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 6, 2010, 1:49pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/10 "2010-04-06T13:49:09Z")

</div>

On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:

> Are their any examples of the Java API that are complete and connect  
> to a remote cluster?

Yes, taken from Terrastore/Elasticsearch integration, look at:

[http://code.google.com/p/terrastore/source/browse/src/main/java/terrastore/search/ElasticSearchServer.java?repo=search](http://code.google.com/p/terrastore/source/browse/src/main/java/terrastore/search/ElasticSearchServer.java?repo=search)  
[http://code.google.com/p/terrastore/source/browse/src/main/java/terrastore/search/ElasticSearchListener.java?repo=search](http://code.google.com/p/terrastore/source/browse/src/main/java/terrastore/search/ElasticSearchListener.java?repo=search)

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 2:06pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/11 "2010-04-06T14:06:05Z")

</div>

what do I put in the configuration parameter?  
Is there somewhere in the spec that lists out the possible parameters  
that can be configured?

On Apr 6, 9:49 am, Sergio Bossa [sergio.bo...@gmail.com](mailto:sergio.bo...@gmail.com) wrote:

> On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:
> 
> > Are their any examples of the Java API that are complete and connect  
> > to a remote cluster?
> 
> Yes, taken from Terrastore/Elasticsearch integration, look at:
> 
> [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/terrastore/source/browse/src/main/java/terra...http://code.google.com/p/terrastore/source/browse/src/main/java/terra)...
> 
> --  
> Sergio Bossahttp://www.linkedin.com/in/sergiob

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 2:08pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/12 "2010-04-06T14:08:36Z")

</div>

Is your server running on the same network?  
I just don't see how I can point the API to a specific cluster.  
We have a test server on our local network and one in the Amazon  
cloud.  
So I want to set parameters according to staging versus production.

On Apr 6, 9:46 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> I really don't understand what the problem is, its working fine for me. The  
> example is what is posted on the doc. If you can provide me with a stack  
> trace when things gets stuck on your end, then I can help further.
> 
> cheer,  
> shay.banon
> 
> On Tue, Apr 6, 2010 at 4:45 PM, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:
> 
> > Yes I've seen that too and then abandoned using the Java API.
> 
> > Are their any examples of the Java API that are complete and connect  
> > to a remote cluster?
> 
> > Thanks,
> 
> > On Apr 6, 9:02 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > You mean its actually getting stuck and does not progress the execution  
> > > to  
> > > the next line? If so, can you post the thread dump?
> 
> > > cheers,  
> > > shay.banon
> 
> > > On Tue, Apr 6, 2010 at 3:55 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> > > 
> > > > yes i tried the transportCLient but my code is getting hosed, it is  
> > > > getting  
> > > > stuck at this particular line
> 
> > > > Client client2 = new TransportClient()  
> > > > .addTransportAddress(new  
> > > > InetSocketTransportAddress("10.0.0.56",  
> > > > 9200));
> 
> > > > ne clues wat i m doing wrong?
> 
> > > > On Tue, Apr 6, 2010 at 8:51 AM, Shay Banon \<  
> > > > [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)\>wrote:
> 
> > > > > The server client way will automatically discover all the other nodes  
> > > > > in  
> > > > > the cluster. If you don't want that, and want to use direct  
> > > > > connection, then  
> > > > > you can use the TransportClient also explained on the page.
> 
> > > > > -shay.banon
> 
> > > > > On Tue, Apr 6, 2010 at 3:50 PM, megha a [amin.me...@gmail.com](mailto:amin.me...@gmail.com) wrote:
> 
> > > > > > hey i saw this, but i want the client to talk to my server at a  
> > > > > > particular ip for example 10.0.0.56. so how to make tat happen? which  
> > > > > > property to set?
> 
> > > > > > On Mon, Apr 5, 2010 at 7:08 PM, Shay Banon \<  
> > > > > > [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com)
> > > > > > 
> > > > > > > wrote:
> 
> > > > > > > Explained here:  
> > > > > > > [http://www.elasticsearch.com/docs/elasticsearch/java\_api/client/](http://www.elasticsearch.com/docs/elasticsearch/java_api/client/).  
> > > > > > > Probably the simplest form would be to use the Server Client. Note,  
> > > > > > > if you  
> > > > > > > use it, make sure to pass -Djava.net.preferIPv4Stack=true for  
> > > > > > > simpler usage.
> 
> > > > > > > cheers,  
> > > > > > > shay.banon
> 
> > > > > > > On Tue, Apr 6, 2010 at 12:07 AM, megAmin [amin.me...@gmail.com](mailto:amin.me...@gmail.com)  
> > > > > > > wrote:
> 
> > > > > > > > hello  
> > > > > > > > i am new to Elasticsearch. i read thru java api on your site but  
> > > > > > > > cudnt understand completely how to create client by establishing  
> > > > > > > > connection to the server. Elasticsearch server is hosted at a  
> > > > > > > > particular IP address and i need to connect to it thru java code.  
> > > > > > > > so  
> > > > > > > > can you please guide me as to which kind of client i should create  
> > > > > > > > and how?
> 
> > > > > > > > thnx

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 6, 2010, 2:09pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/13 "2010-04-06T14:09:14Z")

</div>

On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:

> what do I put in the configuration parameter?

If you use default ES configuration (in particular, default discovery  
configuration), you can leave it empty.

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 2:17pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/14 "2010-04-06T14:17:11Z")

</div>

how does it discover servers on other networks? I have a distributed  
system in both development and production.

On Apr 6, 10:09 am, Sergio Bossa [sergio.bo...@gmail.com](mailto:sergio.bo...@gmail.com) wrote:

> On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:
> 
> > what do I put in the configuration parameter?
> 
> If you use default ES configuration (in particular, default discovery  
> configuration), you can leave it empty.
> 
> --  
> Sergio Bossahttp://www.linkedin.com/in/sergiob

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 6, 2010, 2:17pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/15 "2010-04-06T14:17:41Z")

</div>

On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:

> Is your server running on the same network?  
> I just don't see how I can point the API to a specific cluster.

Default configuration uses IP multicast discovery, so you don't need  
to set anything special (unless you want to specify the multicast  
group).  
However, you'll have hard times trying to use multicast discovery on  
EC2 (or any other cloud provider), so I suggest you to switch to  
seed-based TCP discovery.  
Discovery module configuration is explained at:  
[http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgroups/](http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgroups/)

Hope that helps.  
Cheers,

Sergio B.

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 2:19pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/16 "2010-04-06T14:19:10Z")

</div>

that looks promising. I'll go thrown the docs right now.

On Apr 6, 10:17 am, Sergio Bossa [sergio.bo...@gmail.com](mailto:sergio.bo...@gmail.com) wrote:

> On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:
> 
> > Is your server running on the same network?  
> > I just don't see how I can point the API to a specific cluster.
> 
> Default configuration uses IP multicast discovery, so you don't need  
> to set anything special (unless you want to specify the multicast  
> group).  
> However, you'll have hard times trying to use multicast discovery on  
> EC2 (or any other cloud provider), so I suggest you to switch to  
> seed-based TCP discovery.  
> Discovery module configuration is explained at:[http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgr](http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgr)...
> 
> Hope that helps.  
> Cheers,
> 
> Sergio B.
> 
> --  
> Sergio Bossahttp://www.linkedin.com/in/sergiob

---

<div class="post-metadata">

**Author:** ![Mindgauge](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Mindgauge](https://discuss.elastic.co/u/Mindgauge)\
**Post date:** [April 6, 2010, 3:15pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/17 "2010-04-06T15:15:46Z")

</div>

Sergio, I understand the JGroups configuration now.

Does this also apply to the TransportClient() method for connecting?

In the API documentation it has the following example:

Client client = new TransportClient()  
.addTransportAddress(new InetSocketTransportAddress("host1",  
9800))  
.addTransportAddress(new InetSocketTransportAddress("host2",  
9800));

We cannot get this to work at all. Is there a different port for this  
method of connecting? The example uses 9800 here while everything  
else uses 9200. I know 9200 works on the server and is accessible  
from our development machines but it doesn't work with the  
TransportClient.

On Apr 6, 10:19 am, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:

> that looks promising. I'll go thrown the docs right now.
> 
> On Apr 6, 10:17 am, Sergio Bossa [sergio.bo...@gmail.com](mailto:sergio.bo...@gmail.com) wrote:
> 
> > On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge [mindga...@gmail.com](mailto:mindga...@gmail.com) wrote:
> > 
> > > Is your server running on the same network?  
> > > I just don't see how I can point the API to a specific cluster.
> 
> > Default configuration uses IP multicast discovery, so you don't need  
> > to set anything special (unless you want to specify the multicast  
> > group).  
> > However, you'll have hard times trying to use multicast discovery on  
> > EC2 (or any other cloud provider), so I suggest you to switch to  
> > seed-based TCP discovery.  
> > Discovery module configuration is explained at:[http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgr](http://www.elasticsearch.com/docs/elasticsearch/modules/discovery/jgr)...
> 
> > Hope that helps.  
> > Cheers,
> 
> > Sergio B.
> 
> > --  
> > Sergio Bossahttp://www.linkedin.com/in/sergiob

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 6, 2010, 3:52pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/18 "2010-04-06T15:52:35Z")

</div>

On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:

> Does this also apply to the TransportClient() method for connecting?

Nope, TransportClient is unaware of the server environment, it only  
needs to connect to one or more nodes.

I _think_ the port should be configured (by the server side) as  
described here:  
[http://www.elasticsearch.com/docs/elasticsearch/modules/transport/netty/](http://www.elasticsearch.com/docs/elasticsearch/modules/transport/netty/)  
That is, it's not the standard HTTP port.  
Shay may want to correct me 🙂

Please let us know how it works.

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 6, 2010, 4:06pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/19 "2010-04-06T16:06:18Z")

</div>

Hi,

9200 is the HTTP port, when you use the TransportClient, you would want to  
connect to the transport port (printed in the logs when the server starts  
up). By default, the port is 9300 (if you start another server on the same  
machine, then it will use the next available port). So, when you use the  
TransportClient, you need to use 9300.

By the way, multicast is enabled on GoGrid :).

cheers,  
shay.banon

On Tue, Apr 6, 2010 at 6:52 PM, Sergio Bossa [sergio.bossa@gmail.com](mailto:sergio.bossa@gmail.com) wrote:

> On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge [mindgauge@gmail.com](mailto:mindgauge@gmail.com) wrote:
> 
> > Does this also apply to the TransportClient() method for connecting?
> 
> Nope, TransportClient is unaware of the server environment, it only  
> needs to connect to one or more nodes.
> 
> I _think_ the port should be configured (by the server side) as  
> described here:  
> [http://www.elasticsearch.com/docs/elasticsearch/modules/transport/netty/](http://www.elasticsearch.com/docs/elasticsearch/modules/transport/netty/)  
> That is, it's not the standard HTTP port.  
> Shay may want to correct me 🙂
> 
> Please let us know how it works.
> 
> --  
> Sergio Bossa  
> [http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 6, 2010, 4:10pm UTC](https://discuss.elastic.co/t/new-to-elastic-search/2892/20 "2010-04-06T16:10:01Z")

</div>

On Tue, Apr 6, 2010 at 6:06 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> By the way, multicast is enabled on GoGrid :).

I know, I know, but when I used it (about one year ago), it wasn't  
officially supported and had to tweak iptables ... not so nice 🙂

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

[Next page](https://discuss.elastic.co/t/new-to-elastic-search/2892.md?page=2)
