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+unsubscr...@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.

Reply via email to