# Elasticsearch - node client doesn't connect to cluster

**URL:** <https://discuss.elastic.co/t/elasticsearch-node-client-doesnt-connect-to-cluster/22704>\
**Category:** Elasticsearch\
**Created:** [March 17, 2015, 11:19am UTC](https://discuss.elastic.co/t/elasticsearch-node-client-doesnt-connect-to-cluster/22704 "2015-03-17T11:19:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavel\_2](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@Pavel\_2](https://discuss.elastic.co/u/Pavel_2)\
**Post date:** [March 17, 2015, 11:19am UTC](https://discuss.elastic.co/t/elasticsearch-node-client-doesnt-connect-to-cluster/22704/1 "2015-03-17T11:19:19Z")

</div>

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](http://webserver1.com)][local[1]]{local=true}},  
removed  
{[Pistol][uwaWFb6KTy2Sdoc8TNwdSQ][[webserver1.com](http://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 the 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](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7b60cade-8597-4f94-b5bd-b9af9bc84da8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7b60cade-8597-4f94-b5bd-b9af9bc84da8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:26am UTC](https://discuss.elastic.co/t/elasticsearch-node-client-doesnt-connect-to-cluster/22704/2 "2017-07-06T00:26:21Z")

</div>


