New to elastic search

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

Explained here:
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 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

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.comwrote:

Explained here:
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 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

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 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.comwrote:

Explained here:
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 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

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 wrote:

Explained here: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 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

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.comwrote:

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 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.comwrote:

Explained here:
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 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

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 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.comwrote:

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 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

wrote:

Explained here:
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 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

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 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 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.comwrote:

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 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

wrote:

Explained here:
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 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

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 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 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 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>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 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

wrote:

Explained here:
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
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

On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge 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/ElasticSearchListener.java?repo=search

--
Sergio Bossa
http://www.linkedin.com/in/sergiob

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 wrote:

On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge 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....

--
Sergio Bossahttp://www.linkedin.com/in/sergiob

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 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 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 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 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>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 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

wrote:

Explained here:
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
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

On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge 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

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 wrote:

On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge 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

On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge 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/

Hope that helps.
Cheers,

Sergio B.

--
Sergio Bossa
http://www.linkedin.com/in/sergiob

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

On Apr 6, 10:17 am, Sergio Bossa sergio.bo...@gmail.com wrote:

On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge 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...

Hope that helps.
Cheers,

Sergio B.

--
Sergio Bossahttp://www.linkedin.com/in/sergiob

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 wrote:

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

On Apr 6, 10:17 am, Sergio Bossa sergio.bo...@gmail.com wrote:

On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge 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...

Hope that helps.
Cheers,

Sergio B.

--
Sergio Bossahttp://www.linkedin.com/in/sergiob

On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge 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/
That is, it's not the standard HTTP port.
Shay may want to correct me :slight_smile:

Please let us know how it works.

--
Sergio Bossa
http://www.linkedin.com/in/sergiob

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 wrote:

On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge 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/
That is, it's not the standard HTTP port.
Shay may want to correct me :slight_smile:

Please let us know how it works.

--
Sergio Bossa
http://www.linkedin.com/in/sergiob

On Tue, Apr 6, 2010 at 6:06 PM, Shay Banon 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 :slight_smile:

--
Sergio Bossa
http://www.linkedin.com/in/sergiob