# Connecting ES using RestHighLevelClient

**URL:** <https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970>\
**Category:** Elasticsearch\
**Created:** [May 31, 2018, 5:41am UTC](https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970 "2018-05-31T05:41:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![psramkumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/psramkumar/32/31393_2.png) [@psramkumar](https://discuss.elastic.co/u/psramkumar)\
**Post date:** [May 31, 2018, 5:41am UTC](https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970/1 "2018-05-31T05:41:54Z")

</div>

```
for (int i = 0; i < hostNames.length; i++) {
        HttpHost host = new HttpHost(hostNames[i] , 9200, "index_name"); 
        hosts[i] = host;
 }
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(hosts ));

```

i'm obtaining client using the above code snippet, it works fine when all nodes are available.

it is failing if any one of the node is down.

any solution to handle this situation ?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [June 1, 2018, 9:55am UTC](https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970/2 "2018-06-01T09:55:25Z")

</div>

Does it fail at initialization or when you send a request? Which version are you on? Can you please post the error you get?

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 1, 2018, 10:00am UTC](https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970/3 "2018-06-01T10:00:18Z")

</div>

In which jar are you getting RestHighLevelClient class file?  
i m using 5.6 version restClient and i am not getting to use this class "RestHighLevelClient".

---

<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:** [June 29, 2018, 10:00am UTC](https://discuss.elastic.co/t/connecting-es-using-resthighlevelclient/133970/4 "2018-06-29T10:00:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
