Elasticsearch - node client does not connect to cluster

I have one physical server and I work only on it (no other servers).
At this server I have running elastic 1.4.2 - I use this version as this is the last version elastic osgi bundle is ready for. Also at this server I have glassfish 4.1 as java-ee server.
I run elastic node client inside my java-ee application. And I do it this way:
Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.discovery] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue: 800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]
[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.cluster.service] [tid: _ThreadID=128 _ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]] [timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new [Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][ webserver1.com ][local[1]]{local=true}}, removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][ webserver1.com ][local[1]]{local=true},}, reason: local-disco-initial_connect(master)]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address {inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]
and I get this exeption: ...
Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists! Besides, when I do curl -XGET ' http://localhost:9200/_cluster/state?pretty=1 ' I see there only one node and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I create using java API creates new cluster and dosn't connect to my existing cluster - that's why it says - it's master. Or I don't understand something I have problem with code. Besides I've checked tha name of cluster it's elasticsearch . So, how can I connect to my existing elasticsearch cluster?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426605929.302531214%40f430.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.

Is there a reason not to just specify the IP address and to try and rely on
multicast?

I realize this is all on one node as you have stated that, but that seems
even more reason that it would be little issue to specify the IP. While
multicast makes it easy to stand up a cluster in an ideal situation, my
experience has been that it leads to more problems down the road, and
things generally work better when not using multicast. I heard the same
suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).

At this server I have running elastic 1.4.2 - I use this version as this
is the last version elastic osgi bundle is ready for. Also at this server I
have glassfish 4.1 as java-ee server.

I run elastic node client inside my java-ee application. And I do it this
way:

Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.discovery] [tid: _ThreadID=30
_ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue:
800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]

[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.cluster.service] [tid: _ThreadID=128
_ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]]
[timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new
[Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][webserver1.com][local[1]]{local=true}},
removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][webserver1.com][local[1]]{local=true},},
reason: local-disco-initial_connect(master)]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address
{inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]

and I get this exeption: ...

Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists!
Besides, when I do curl -XGET '
http://localhost:9200/_cluster/state?pretty=1' I see there only one node
and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I
create using java API creates new cluster and dosn't connect to my existing
cluster - that's why it says - it's master. Or I don't understand something
I have problem with code. Besides I've checked tha name of cluster it's
elasticsearch. So, how can I connect to my existing elasticsearch cluster?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

We do recommend to use unicast in production.

On 17 March 2015 at 09:46, aaron@definemg.com wrote:

Is there a reason not to just specify the IP address and to try and rely
on multicast?

I realize this is all on one node as you have stated that, but that seems
even more reason that it would be little issue to specify the IP. While
multicast makes it easy to stand up a cluster in an ideal situation, my
experience has been that it leads to more problems down the road, and
things generally work better when not using multicast. I heard the same
suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).

At this server I have running elastic 1.4.2 - I use this version as this
is the last version elastic osgi bundle is ready for. Also at this server I
have glassfish 4.1 as java-ee server.

I run elastic node client inside my java-ee application. And I do it this
way:

Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.discovery] [tid: _ThreadID=30
_ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue:
800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]

[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.cluster.service] [tid: _ThreadID=128
_ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]]
[timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new
[Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][webserver1.com][local[1]]{local=true}},
removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][webserver1.com
][local[1]]{local=true},}, reason: local-disco-initial_connect(master)]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address
{inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]

and I get this exeption: ...

Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists!
Besides, when I do curl -XGET 'http://localhost:9200/_
cluster/state?pretty=1' I see there only one node and this is not
SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I create using java API
creates new cluster and dosn't connect to my existing cluster - that's why
it says - it's master. Or I don't understand something I have problem with
code. Besides I've checked tha name of cluster it's elasticsearch. So,
how can I connect to my existing elasticsearch cluster?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9vWq4qv0N_uCego5Q%3DTTriCRcuVKp8UVLJoiWh75TuTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

I am quite newbie to elactis. Could you explain with java code what you mean?

Вторник, 17 марта 2015, 9:46 -07:00 от aaron@definemg.com:

Is there a reason not to just specify the IP address and to try and rely on multicast?

I realize this is all on one node as you have stated that, but that seems even more reason that it would be little issue to specify the IP. While multicast makes it easy to stand up a cluster in an ideal situation, my experience has been that it leads to more problems down the road, and things generally work better when not using multicast. I heard the same suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).
At this server I have running elastic 1.4.2 - I use this version as this is the last version elastic osgi bundle is ready for. Also at this server I have glassfish 4.1 as java-ee server.
I run elastic node client inside my java-ee application. And I do it this way:
Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.discovery] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue: 800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]
[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.cluster.service] [tid: _ThreadID=128 _ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]] [timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new [Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][ webserver1.com ][local[1]]{local=true}}, removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][ webserver1.com ][local[1]]{local=true},}, reason: local-disco-initial_connect(master)]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address {inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]
and I get this exeption: ...
Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists! Besides, when I do curl -XGET ' http://localhost:9200/_cluster/state?pretty=1 ' I see there only one node and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I create using java API creates new cluster and dosn't connect to my existing cluster - that's why it says - it's master. Or I don't understand something I have problem with code. Besides I've checked tha name of cluster it's elasticsearch. So, how can I connect to my existing elasticsearch cluster?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426612750.154168089%40f37.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.

This is what I use in my code, not sure how correct it is given the abysmal
state of the the Java API documentation.

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

    Settings settings = ImmutableSettings.settingsBuilder()
                            .put("cluster.name", elasticClusterName)
                            .put("client.transport.sniff",

true).build();

    esClient = new TransportClient(settings)
        .addTransportAddress(new

InetSocketTransportAddress(elasticHost,elasticPort));

On Tue, Mar 17, 2015 at 11:19 AM, Александр Свиридов ooo_saturn7@mail.ru
wrote:

I am quite newbie to elactis. Could you explain with java code what you
mean?

Вторник, 17 марта 2015, 9:46 -07:00 от aaron@definemg.com:

Is there a reason not to just specify the IP address and to try and
rely on multicast?

I realize this is all on one node as you have stated that, but that seems
even more reason that it would be little issue to specify the IP. While
multicast makes it easy to stand up a cluster in an ideal situation, my
experience has been that it leads to more problems down the road, and
things generally work better when not using multicast. I heard the same
suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).

At this server I have running elastic 1.4.2 - I use this version as this
is the last version elastic osgi bundle is ready for. Also at this server I
have glassfish 4.1 as java-ee server.

I run elastic node client inside my java-ee application. And I do it this
way:

Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.discovery] [tid: _ThreadID=30
_ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue:
800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]

[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.cluster.service] [tid: _ThreadID=128
_ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]]
[timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new
[Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][webserver1.com][local[1]]{local=true}},
removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][webserver1.com][local[1]]{local=true},},
reason: local-disco-initial_connect(master)]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address
{inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]

and I get this exeption: ...

Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists!
Besides, when I do curl -XGET '
http://localhost:9200/_cluster/state?pretty=1' I see there only one node
and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I
create using java API creates new cluster and dosn't connect to my existing
cluster - that's why it says - it's master. Or I don't understand something
I have problem with code. Besides I've checked tha name of cluster it's
elasticsearch. So, how can I connect to my existing elasticsearch cluster?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com
https://e.mail.ru/compose/?mailto=mailto%3Aelasticsearch%2Bunsubscribe@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9vEEqMBeCT6JjnzJbLs3XQYK882cARK1E0fWU9ZjgQATkCyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thank you. I did this way:

Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "elasticsearch")
.put("client.transport.sniff", true).build();

    Client client = new TransportClient(settings)
        .addTransportAddress(new InetSocketTransportAddress("localhost",9300));

And everything works fine. So, both cluster and index exist.

However, as I understand it is not node client. What you sugget is transport client. Now I want to understand how to make node client work.

Вторник, 17 марта 2015, 11:26 -06:00 от Aaron Mefford aaron@definemg.com:

This is what I use in my code, not sure how correct it is given the abysmal state of the the Java API documentation.

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

   Settings settings = ImmutableSettings.settingsBuilder()
                           .put(" cluster.name ", elasticClusterName)
                           .put("client.transport.sniff", true).build();

   esClient = new TransportClient(settings)
       .addTransportAddress(new InetSocketTransportAddress(elasticHost,elasticPort));

On Tue, Mar 17, 2015 at 11:19 AM, Александр Свиридов < ooo_saturn7@mail.ru > wrote:

I am quite newbie to elactis. Could you explain with java code what you mean?

Вторник, 17 марта 2015, 9:46 -07:00 от aaron@definemg.com :

Is there a reason not to just specify the IP address and to try and rely on multicast?

I realize this is all on one node as you have stated that, but that seems even more reason that it would be little issue to specify the IP. While multicast makes it easy to stand up a cluster in an ideal situation, my experience has been that it leads to more problems down the road, and things generally work better when not using multicast. I heard the same suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).
At this server I have running elastic 1.4.2 - I use this version as this is the last version elastic osgi bundle is ready for. Also at this server I have glassfish 4.1 as java-ee server.
I run elastic node client inside my java-ee application. And I do it this way:
Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.discovery] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue: 800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]
[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.cluster.service] [tid: _ThreadID=128 _ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]] [timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new [Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][ webserver1.com ][local[1]]{local=true}}, removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][ webserver1.com ][local[1]]{local=true},}, reason: local-disco-initial_connect(master)]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address {inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]
and I get this exeption: ...
Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists! Besides, when I do curl -XGET ' http://localhost:9200/_cluster/state?pretty=1 ' I see there only one node and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I create using java API creates new cluster and dosn't connect to my existing cluster - that's why it says - it's master. Or I don't understand something I have problem with code. Besides I've checked tha name of cluster it's elasticsearch. So, how can I connect to my existing elasticsearch cluster?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9vEEqMBeCT6JjnzJbLs3XQYK882cARK1E0fWU9ZjgQATkCyQ%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426614139.905053331%40f89.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.

What is the advantage you expect from using the Node client, especially in
a single node environment?

With client.transport.sniff true it should discover the other nodes, if
other nodes exist.

On Tue, Mar 17, 2015 at 11:42 AM, Александр Свиридов ooo_saturn7@mail.ru
wrote:

Thank you. I did this way:

Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "elasticsearch")
.put("client.transport.sniff",
true).build();

    Client client = new TransportClient(settings)
        .addTransportAddress(new

InetSocketTransportAddress("localhost",9300));

And everything works fine. So, both cluster and index exist.

However, as I understand it is not node client. What you sugget is
transport client. Now I want to understand how to make node client work.

Вторник, 17 марта 2015, 11:26 -06:00 от Aaron Mefford <aaron@definemg.com

:

This is what I use in my code, not sure how correct it is given the
abysmal state of the the Java API documentation.

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

    Settings settings = ImmutableSettings.settingsBuilder()
                            .put("cluster.name", elasticClusterName)
                            .put("client.transport.sniff",

true).build();

    esClient = new TransportClient(settings)
        .addTransportAddress(new

InetSocketTransportAddress(elasticHost,elasticPort));

On Tue, Mar 17, 2015 at 11:19 AM, Александр Свиридов <ooo_saturn7@mail.ru
https://e.mail.ru/compose/?mailto=mailto%3Aooo_saturn7@mail.ru> wrote:

I am quite newbie to elactis. Could you explain with java code what you
mean?

Вторник, 17 марта 2015, 9:46 -07:00 от aaron@definemg.com
https://e.mail.ru/compose/?mailto=mailto%3Aaaron@definemg.com:

Is there a reason not to just specify the IP address and to try and
rely on multicast?

I realize this is all on one node as you have stated that, but that seems
even more reason that it would be little issue to specify the IP. While
multicast makes it easy to stand up a cluster in an ideal situation, my
experience has been that it leads to more problems down the road, and
things generally work better when not using multicast. I heard the same
suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).

At this server I have running elastic 1.4.2 - I use this version as this
is the last version elastic osgi bundle is ready for. Also at this server I
have glassfish 4.1 as java-ee server.

I run elastic node client inside my java-ee application. And I do it this
way:

Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.discovery] [tid: _ThreadID=30
_ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue:
800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]

[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.cluster.service] [tid: _ThreadID=128
_ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]]
[timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new
[Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][webserver1.com][local[1]]{local=true}},
removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][webserver1.com][local[1]]{local=true},},
reason: local-disco-initial_connect(master)]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address
{inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]

[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] []
[org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)]
[timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]

and I get this exeption: ...

Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists!
Besides, when I do curl -XGET '
http://localhost:9200/_cluster/state?pretty=1' I see there only one node
and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I
create using java API creates new cluster and dosn't connect to my existing
cluster - that's why it says - it's master. Or I don't understand something
I have problem with code. Besides I've checked tha name of cluster it's
elasticsearch. So, how can I connect to my existing elasticsearch cluster?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com
https://e.mail.ru/compose/?mailto=mailto%3Aelasticsearch%2Bunsubscribe@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com
https://e.mail.ru/compose/?mailto=mailto%3Aelasticsearch%2Bunsubscribe@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAF9vEEqMBeCT6JjnzJbLs3XQYK882cARK1E0fWU9ZjgQATkCyQ%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAF9vEEqMBeCT6JjnzJbLs3XQYK882cARK1E0fWU9ZjgQATkCyQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9vEEp6FjLMnrb1GcyDhCfFL794zwFGOvMHJG4qGCc%3DYZ769g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

I agree with you that in single node environment only transport layer should be used. But I want to know how to make node client work because maybe I will need it in future and I want to know what I can do with elastic java api.

Вторник, 17 марта 2015, 11:56 -06:00 от Aaron Mefford aaron@definemg.com:

What is the advantage you expect from using the Node client, especially in a single node environment?

With client.transport.sniff true it should discover the other nodes, if other nodes exist.

On Tue, Mar 17, 2015 at 11:42 AM, Александр Свиридов < ooo_saturn7@mail.ru > wrote:

Thank you. I did this way:

Settings settings = ImmutableSettings.settingsBuilder()
.put(" cluster.name ", "elasticsearch")
.put("client.transport.sniff", true).build();

   Client client = new TransportClient(settings)
       .addTransportAddress(new InetSocketTransportAddress("localhost",9300));

And everything works fine. So, both cluster and index exist.

However, as I understand it is not node client. What you sugget is transport client. Now I want to understand how to make node client work.

Вторник, 17 марта 2015, 11:26 -06:00 от Aaron Mefford < aaron@definemg.com >:

This is what I use in my code, not sure how correct it is given the abysmal state of the the Java API documentation.

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;

   Settings settings = ImmutableSettings.settingsBuilder()
                           .put(" cluster.name ", elasticClusterName)
                           .put("client.transport.sniff", true).build();

   esClient = new TransportClient(settings)
       .addTransportAddress(new InetSocketTransportAddress(elasticHost,elasticPort));

On Tue, Mar 17, 2015 at 11:19 AM, Александр Свиридов < ooo_saturn7@mail.ru > wrote:

I am quite newbie to elactis. Could you explain with java code what you mean?

Вторник, 17 марта 2015, 9:46 -07:00 от aaron@definemg.com :

Is there a reason not to just specify the IP address and to try and rely on multicast?

I realize this is all on one node as you have stated that, but that seems even more reason that it would be little issue to specify the IP. While multicast makes it easy to stand up a cluster in an ideal situation, my experience has been that it leads to more problems down the road, and things generally work better when not using multicast. I heard the same suggestion repeatedly at Elastic{on}.

Aaron

On Tuesday, March 17, 2015 at 9:25:46 AM UTC-6, ooo_saturn7 wrote:

I have one physical server and I work only on it (no other servers).
At this server I have running elastic 1.4.2 - I use this version as this is the last version elastic osgi bundle is ready for. Also at this server I have glassfish 4.1 as java-ee server.
I run elastic node client inside my java-ee application. And I do it this way:
Node node = nodeBuilder().local(true).clusterName("elasticsearch").node();
Client client = node.client();
GetResponse getResponse = client.prepareGet("my.index-0.2.2","post","1").execute().actionGet();
Map<String,Object> source = getResponse.getSource();
System.out.println("------------------------------");
System.out.println("Index: "+ getResponse.getIndex());
System.out.println("Type: "+ getResponse.getType());
System.out.println("Id: "+ getResponse.getId());
System.out.println("Version: "+ getResponse.getVersion());
System.out.println(source);

In log I see the following:

[2015-03-17T12:57:44.447+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.discovery] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664447] [levelValue: 800] [[ [Pistol] elasticsearch/SCKIrGHQTaC5eEYmYfZ0Iw]]
[2015-03-17T12:57:44.449+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.cluster.service] [tid: _ThreadID=128 _ThreadName=elasticsearch[Pistol][clusterService#updateTask][T#1]] [timeMillis: 1426582664449] [levelValue: 800] [[ [Pistol] master {new [Pistol][SCKIrGHQTaC5eEYmYfZ0Iw][ webserver1.com ][local[1]]{local=true}}, removed {[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][ webserver1.com ][local[1]]{local=true},}, reason: local-disco-initial_connect(master)]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.http] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] bound_address {inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/SERVER IP:9202]}]]
[2015-03-17T12:57:44.502+0400] [glassfish 4.1] [INFO] [] [org.elasticsearch.node] [tid: _ThreadID=30 _ThreadName=http-listener-1(1)] [timeMillis: 1426582664502] [levelValue: 800] [[ [Pistol] started]]
and I get this exeption: ...
Caused by: org.elasticsearch.indices.IndexMissingException:[my.index-0.2.2] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768)
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691)
at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:139)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.(TransportShardSingleOperationAction.java:116)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89)
at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98)
at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)

So it can't find the index - my.index-0.2.2. However this index exists! Besides, when I do curl -XGET ' http://localhost:9200/_cluster/state?pretty=1 ' I see there only one node and this is not SCKIrGHQTaC5eEYmYfZ0Iw. I suppose that the node I create using java API creates new cluster and dosn't connect to my existing cluster - that's why it says - it's master. Or I don't understand something I have problem with code. Besides I've checked tha name of cluster it's elasticsearch. So, how can I connect to my existing elasticsearch cluster?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9156e467-ce1d-495f-bda5-647e059e004c%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9vEEqMBeCT6JjnzJbLs3XQYK882cARK1E0fWU9ZjgQATkCyQ%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9vEEp6FjLMnrb1GcyDhCfFL794zwFGOvMHJG4qGCc%3DYZ769g%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426615533.195965100%40f37.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.

I am newbie in elastic and I don't understand how should I work with transport client connections. Should I use singleton for Client, something like

class ElasticClientManager {
private static Client client;

public static Client getClient(){
if (client==null) {
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "elasticsearch")
.put("client.transport.sniff", true).build();

   client = new TransportClient(settings)
        .addTransportAddress(new InetSocketTransportAddress("localhost",9300));
}

return client;
}
}

By other words - I create one client and keep the reference in it in singleton. Every time I need to query elastic I do

Client client = ElasticClientManager.getClient();
GetResponse getResponse = client.prepareGet(....).execute().actionGet();

Is such approach right?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426616386.538391541%40f217.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.

Hi,

You are correct that you should not create a new client for every connection, but rather re-use a single client.

Note that all the client methods support being called asynchronously by passing in a response listener, or returning a future. Which is to say, if you are submitting several queries at once, you need not wait for each to return before submitting the next.

  • Andrew

On Mar 17, 2015, at 11:19 AM, Александр Свиридов ooo_saturn7@mail.ru wrote:

I am newbie in elastic and I don't understand how should I work with transport client connections. Should I use singleton for Client, something like

class ElasticClientManager {
private static Client client;

public static Client getClient(){
if (client==null) {
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "elasticsearch")
.put("client.transport.sniff", true).build();

   client = new TransportClient(settings)
        .addTransportAddress(new InetSocketTransportAddress("localhost",9300));
}

return client;
}
}

By other words - I create one client and keep the reference in it in singleton. Every time I need to query elastic I do

Client client = ElasticClientManager.getClient();
GetResponse getResponse = client.prepareGet(....).execute().actionGet();

Is such approach right?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426616386.538391541%40f217.i.mail.ru https://groups.google.com/d/msgid/elasticsearch/1426616386.538391541%40f217.i.mail.ru?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/D0A19724-7A49-4828-B9D1-5FD67401830E%40elastic.co.
For more options, visit https://groups.google.com/d/optout.