New to elastic search

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

New to elastic search

megAmin
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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

kimchy
Administrator
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 <[hidden email]> wrote:
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

Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

megAmin
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 <[hidden email]> 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 <[hidden email]> wrote:
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


Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

kimchy
Administrator
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> wrote:
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



Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

megAmin
In reply to this post by kimchy
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 <[hidden email]> 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 <[hidden email]> wrote:
> > 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

megAmin
In reply to this post by kimchy
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> wrote:
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




Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

kimchy
Administrator
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> wrote:
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





Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Mindgauge
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>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 <[hidden email]> 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 <[hidden email]
> >>> > 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 <[hidden email]> wrote:
>
> >>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

kimchy
Administrator
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>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 <[hidden email]> 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 <[hidden email]
> >>> > 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 <[hidden email]> wrote:
>
> >>>>> 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

Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Sergio Bossa
In reply to this post by Mindgauge
On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Mindgauge
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 <[hidden email]> wrote:

> On Tue, Apr 6, 2010 at 3:45 PM, Mindgauge <[hidden email]> 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/terra...http://code.google.com/p/terrastore/source/browse/src/main/java/terra...
>
> --
> Sergio Bossahttp://www.linkedin.com/in/sergiob
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Mindgauge
In reply to this post by kimchy
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <
> > [hidden email]>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 <[hidden email]> 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 <
> > [hidden email]
> > > >>> > 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 <[hidden email]>
> > wrote:
>
> > > >>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Sergio Bossa
In reply to this post by Mindgauge
On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Mindgauge
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 <[hidden email]> wrote:
> On Tue, Apr 6, 2010 at 4:06 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Sergio Bossa
In reply to this post by Mindgauge
On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

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

On Apr 6, 10:17 am, Sergio Bossa <[hidden email]> wrote:

> On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Mindgauge
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 <[hidden email]> wrote:

> that looks promising.  I'll go thrown the docs right now.
>
> On Apr 6, 10:17 am, Sergio Bossa <[hidden email]> wrote:
>
>
>
> > On Tue, Apr 6, 2010 at 4:08 PM, Mindgauge <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Sergio Bossa
On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge <[hidden email]> 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 :)

Please let us know how it works.

--
Sergio Bossa
http://www.linkedin.com/in/sergiob
Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

kimchy
Administrator
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 <[hidden email]> wrote:
On Tue, Apr 6, 2010 at 5:15 PM, Mindgauge <[hidden email]> 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 :)

Please let us know how it works.

--
Sergio Bossa

Reply | Threaded
Open this post in threaded view
|

Re: New to elastic search

Sergio Bossa
On Tue, Apr 6, 2010 at 6:06 PM, Shay Banon <[hidden email]> 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
12