# How to connect client in LAN (newbie)

**URL:** <https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724>\
**Category:** Elasticsearch\
**Created:** [January 3, 2011, 7:59am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724 "2011-01-03T07:59:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [January 3, 2011, 7:59am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/1 "2011-01-03T07:59:17Z")

</div>

Hi,  
I am new to Elasticsearch and I tried to connect elastic search client running in my local network , but I am getting index missing exception. Here is my code

NodeBuilder node = nodeBuilder();//.client(true).node();  
node.settings().put("cluster.name", "CapdigiRA2");  
node.settings().put("node.local", "false");  
node.settings().put("discovery.zen.ping.unicast.hosts","192.168.65.1:9302");  
Client clientNew = node.client(true).node().client();  
CountRequest cr = new CountRequest("db2028") ;  
cr.query(queryString("\_currentstatus:x"));  
ActionFuture af = clientNew.count(cr);  
CountResponse cres = af.actionGet();  
System.out.println(cres.count()) ;

Here is my node info

{  
"cluster\_name": "TEST",  
"nodes": {  
"1tlhBHXWTnyDh6C\_ez9FpA": {  
"name": "Crooked Man",  
"transport\_address": "inet[/192.168.65.1:9300]",  
"attributes": {  
"client": "true",  
"data": "false"  
},  
"http\_address": "inet[/192.168.65.1:9200]",  
"os": {},  
"process": {  
"id": 2260  
},  
"jvm": {  
"pid": 2260,  
"vm\_name": "Java HotSpot(TM) 64-Bit Server VM",  
"vm\_version": "16.0-b13",  
"vm\_vendor": "Sun Microsystems Inc.",  
"start\_time": 1293698827694  
},  
"network": {},  
"thread\_pool": {  
"type": "cached",  
"min\_threads": 0,  
"max\_threads": -1,  
"scheduler\_threads": 20  
},  
"transport": {  
"bound\_address": "inet[/0.0.0.0:9300]",  
"publish\_address": "inet[/192.168.65.1:9300]"  
}  
},  
"RjR1AtROQreajr24xTS1Qg": {  
"name": "Captain Zero",  
"transport\_address": "inet[/192.168.65.1:9302]",  
"attributes": {},  
"http\_address": "inet[/192.168.65.1:9202]",  
"os": {  
"cpu": {  
"vendor": "Intel",  
"model": "Xeon",  
"mhz": 2400,  
"total\_cores": 8,  
"total\_sockets": 8,  
"cores\_per\_socket": 1,  
"cache\_size": "-1b",  
"cache\_size\_in\_bytes": -1  
},  
"mem": {  
"total": "15.9gb",  
"total\_in\_bytes": 17168867328  
},  
"swap": {  
"total": "19.3gb",  
"total\_in\_bytes": 20825812992  
}  
},  
"process": {  
"id": 6340  
},  
"jvm": {  
"pid": 6340,  
"vm\_name": "Java HotSpot(TM) Client VM",  
"vm\_version": "17.0-b16",  
"vm\_vendor": "Sun Microsystems Inc.",  
"start\_time": 1293698911095  
},  
"network": {  
"primary\_interface": {  
"address": "192.168.0.141",  
"name": "eth0",  
"mac\_address": "18:A9:05:63:8C:4A"  
}  
},  
"thread\_pool": {  
"type": "cached",  
"min\_threads": 0,  
"max\_threads": -1,  
"scheduler\_threads": 20  
},  
"transport": {  
"bound\_address": "inet[/0.0.0.0:9302]",  
"publish\_address": "inet[/192.168.65.1:9302]"  
}  
},  
"umfr8akMTtOwDCxmqr7IfQ": {  
"name": "Jameson, J. Jonah",  
"transport\_address": "inet[/192.168.65.1:9301]",  
"attributes": {  
"client": "true",  
"data": "false"  
},  
"http\_address": "inet[/192.168.65.1:9201]",  
"os": {},  
"process": {  
"id": 2260  
},  
"jvm": {  
"pid": 2260,  
"vm\_name": "Java HotSpot(TM) 64-Bit Server VM",  
"vm\_version": "16.0-b13",  
"vm\_vendor": "Sun Microsystems Inc.",  
"start\_time": 1293698827694  
},  
"network": {  
"primary\_interface": {  
"address": "",  
"name": "",  
"mac\_address": ""  
}  
},  
"thread\_pool": {  
"type": "cached",  
"min\_threads": 0,  
"max\_threads": -1,  
"scheduler\_threads": 20  
},  
"transport": {  
"bound\_address": "inet[/0.0.0.0:9301]",  
"publish\_address": "inet[/192.168.65.1:9301]"  
}  
}  
}  
}

Kindly help me. I think I am missing something. But not able to resolve.  
Is there any sample code available to test this ?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 3, 2011, 9:17am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/2 "2011-01-03T09:17:04Z")

</div>

Hi,

Can you check if adding Thread.sleep(10000) after the construction of the  
node and calling the count request, does it work then?

-shay.banon

On Mon, Jan 3, 2011 at 9:59 AM, srrIN [srrranga@gmail.com](mailto:srrranga@gmail.com) wrote:

> Hi,  
> I am new to Elasticsearch and I tried to connect Elasticsearch client  
> running in my local network , but I am getting index missing exception.  
> Here  
> is my code
> 
> NodeBuilder node = nodeBuilder();//.client(true).node();  
> node.settings().put("cluster.name", "CapdigiRA2");  
> node.settings().put("node.local", "false");
> 
> node.settings().put("discovery.zen.ping.unicast.hosts","192.168.65.1:9302  
> ");  
> Client clientNew = node.client(true).node().client();  
> CountRequest cr = new CountRequest("db2028") ;  
> cr.query(queryString("\_currentstatus:x"));  
> ActionFuture af = clientNew.count(cr);  
> CountResponse cres = af.actionGet();  
> System.out.println(cres.count()) ;
> 
> Here is my node info
> 
> {  
> "cluster\_name": "TEST",  
> "nodes": {  
> "1tlhBHXWTnyDh6C\_ez9FpA": {  
> "name": "Crooked Man",  
> "transport\_address": "inet[/192.168.65.1:9300]",  
> "attributes": {  
> "client": "true",  
> "data": "false"  
> },  
> "http\_address": "inet[/192.168.65.1:9200]",  
> "os": {},  
> "process": {  
> "id": 2260  
> },  
> "jvm": {  
> "pid": 2260,  
> "vm\_name": "Java HotSpot(TM) 64-Bit Server VM",  
> "vm\_version": "16.0-b13",  
> "vm\_vendor": "Sun Microsystems Inc.",  
> "start\_time": 1293698827694  
> },  
> "network": {},  
> "thread\_pool": {  
> "type": "cached",  
> "min\_threads": 0,  
> "max\_threads": -1,  
> "scheduler\_threads": 20  
> },  
> "transport": {  
> "bound\_address": "inet[/0.0.0.0:9300]",  
> "publish\_address": "inet[/192.168.65.1:9300]"  
> }  
> },  
> "RjR1AtROQreajr24xTS1Qg": {  
> "name": "Captain Zero",  
> "transport\_address": "inet[/192.168.65.1:9302]",  
> "attributes": {},  
> "http\_address": "inet[/192.168.65.1:9202]",  
> "os": {  
> "cpu": {  
> "vendor": "Intel",  
> "model": "Xeon",  
> "mhz": 2400,  
> "total\_cores": 8,  
> "total\_sockets": 8,  
> "cores\_per\_socket": 1,  
> "cache\_size": "-1b",  
> "cache\_size\_in\_bytes": -1  
> },  
> "mem": {  
> "total": "15.9gb",  
> "total\_in\_bytes": 17168867328  
> },  
> "swap": {  
> "total": "19.3gb",  
> "total\_in\_bytes": 20825812992  
> }  
> },  
> "process": {  
> "id": 6340  
> },  
> "jvm": {  
> "pid": 6340,  
> "vm\_name": "Java HotSpot(TM) Client VM",  
> "vm\_version": "17.0-b16",  
> "vm\_vendor": "Sun Microsystems Inc.",  
> "start\_time": 1293698911095  
> },  
> "network": {  
> "primary\_interface": {  
> "address": "192.168.0.141",  
> "name": "eth0",  
> "mac\_address": "18:A9:05:63:8C:4A"  
> }  
> },  
> "thread\_pool": {  
> "type": "cached",  
> "min\_threads": 0,  
> "max\_threads": -1,  
> "scheduler\_threads": 20  
> },  
> "transport": {  
> "bound\_address": "inet[/0.0.0.0:9302]",  
> "publish\_address": "inet[/192.168.65.1:9302]"  
> }  
> },  
> "umfr8akMTtOwDCxmqr7IfQ": {  
> "name": "Jameson, J. Jonah",  
> "transport\_address": "inet[/192.168.65.1:9301]",  
> "attributes": {  
> "client": "true",  
> "data": "false"  
> },  
> "http\_address": "inet[/192.168.65.1:9201]",  
> "os": {},  
> "process": {  
> "id": 2260  
> },  
> "jvm": {  
> "pid": 2260,  
> "vm\_name": "Java HotSpot(TM) 64-Bit Server VM",  
> "vm\_version": "16.0-b13",  
> "vm\_vendor": "Sun Microsystems Inc.",  
> "start\_time": 1293698827694  
> },  
> "network": {  
> "primary\_interface": {  
> "address": "",  
> "name": "",  
> "mac\_address": ""  
> }  
> },  
> "thread\_pool": {  
> "type": "cached",  
> "min\_threads": 0,  
> "max\_threads": -1,  
> "scheduler\_threads": 20  
> },  
> "transport": {  
> "bound\_address": "inet[/0.0.0.0:9301]",  
> "publish\_address": "inet[/192.168.65.1:9301]"  
> }  
> }  
> }  
> }
> 
> Kindly help me. I think I am missing something. But not able to resolve.  
> Is there any sample code available to test this ?
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183522.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183522.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [January 3, 2011, 9:43am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/3 "2011-01-03T09:43:04Z")

</div>

Hi Shay,  
Thanks for your immediate reply.  
I am still getting the same error.

Can you check my node info and check whether I am connecting to correct client.  
My ES instance is running in a different machine in LAN environment and trying to connect from my local machine.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 3, 2011, 10:21am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/4 "2011-01-03T10:21:45Z")

</div>

You cluster.name of the nodes you started seems to be TEST, and you define a  
different one when you construct the node client, maybe thats the problem?

On Mon, Jan 3, 2011 at 11:43 AM, srrIN [srrranga@gmail.com](mailto:srrranga@gmail.com) wrote:

> Hi Shay,  
> Thanks for your immediate reply.  
> I am still getting the same error.
> 
> Can you check my node info and check whether I am connecting to correct  
> client.  
> My ES instance is running in a different machine in LAN environment and  
> trying to connect from my local machine.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183814.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183814.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [January 3, 2011, 10:47am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/5 "2011-01-03T10:47:45Z")

</div>

Hi Shay,  
I changed the Cluster.name and still the problem not solved. If there is any sample or examples available to connect ES instance running in different machine? please send me the link.  
Please find the exceptions I have encountered while connecting

Exception in thread "main" org.elasticsearch.indices.IndexMissingException: [db2028] missing  
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:161)  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.(TransportBroadcastOperationAction.java:153)  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:73)  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:53)  
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:54)  
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:43)  
at org.elasticsearch.client.node.NodeClient.count(NodeClient.java:150)  
at com.capdigisoft.bulk.IndexerRunner.main(IndexerRunner.java:71)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 3, 2011, 10:50am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/6 "2011-01-03T10:50:11Z")

</div>

Do you have that index?

On Mon, Jan 3, 2011 at 12:47 PM, srrIN [srrranga@gmail.com](mailto:srrranga@gmail.com) wrote:

> Hi Shay,  
> I changed the Cluster.name and still the problem not solved. Please find  
> the  
> exceptions
> 
> Exception in thread "main" org.elasticsearch.indices.IndexMissingException:  
> [db2028] missing  
> at
> 
> org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:161)  
> at
> 
> org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.(TransportBroadcastOperationAction.java:153)  
> at
> 
> org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:73)  
> at
> 
> ## org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:53) at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:54) at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:43) at org.elasticsearch.client.node.NodeClient.count(NodeClient.java:150) at com.capdigisoft.bulk.IndexerRunner.main(IndexerRunner.java:71)
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184033.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184033.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [January 3, 2011, 10:53am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/7 "2011-01-03T10:53:59Z")

</div>

Yes, the index existing in the path. Also I changed and checked for some other index. But it ended up with same error message. I am not sure whether the client has connected to correct cluster or not.

I would like to add one more point. My Elastic search instance is running as a SERVICE.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 3, 2011, 10:54am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/8 "2011-01-03T10:54:51Z")

</div>

You can issue a cluster health or state request from the client and check  
that.

On Mon, Jan 3, 2011 at 12:54 PM, srrIN [srrranga@gmail.com](mailto:srrranga@gmail.com) wrote:

> Yes, the index existing in the path. Also I changed and checked for some  
> other index. But it ended up with same error message. I am not sure whether  
> the client has connected to correct cluster or not.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184060.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184060.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![srrin](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@srrin](https://discuss.elastic.co/u/srrin)\
**Post date:** [January 3, 2011, 10:57am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/9 "2011-01-03T10:57:02Z")

</div>

Hi Shay,  
Can you post a sample code snippet for the same?  
Or if there is any link please provide me.  
Thank you

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 3, 2011, 1:43pm UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/10 "2011-01-03T13:43:31Z")

</div>

client.cluster.prepareXXX are where the health and state API are. For  
information, see the REST section in the docs (the options are the same).

On Mon, Jan 3, 2011 at 12:57 PM, srrIN [srrranga@gmail.com](mailto:srrranga@gmail.com) wrote:

> ## Hi Shay, Can you post a sample code snippet for the same? Or if there is any link please provide me. Thank you
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184067.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184067.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:14am UTC](https://discuss.elastic.co/t/how-to-connect-client-in-lan-newbie/3724/11 "2017-07-06T04:14:29Z")

</div>


