# Failed to initialize connection: None of the configured nodes were available

**URL:** <https://discuss.elastic.co/t/failed-to-initialize-connection-none-of-the-configured-nodes-were-available/96790>\
**Category:** Elasticsearch\
**Created:** [August 11, 2017, 3:07pm UTC](https://discuss.elastic.co/t/failed-to-initialize-connection-none-of-the-configured-nodes-were-available/96790 "2017-08-11T15:07:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sravan\_kumar1](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sravan\_kumar1](https://discuss.elastic.co/u/sravan_kumar1)\
**Post date:** [August 11, 2017, 3:07pm UTC](https://discuss.elastic.co/t/failed-to-initialize-connection-none-of-the-configured-nodes-were-available/96790/1 "2017-08-11T15:07:00Z")

</div>

I am trying to connect to my local elastic search instance by using the elastic 4s library

> **[sksamuel/elastic4s](https://github.com/sksamuel/elastic4s)**
>
> elastic4s - Elasticsearch Scala Client - Non Blocking, Type Safe, HTTP, TCP

val esSettings = Settings.builder().put("[cluster.name](http://cluster.name)", "cluster name").build()  
val esClient = TcpClient.transport(esSettings,ElasticsearchClientUri(host:port))

and trying to bulk insert using

esClient.execute {  
bulk(  
//bulk insert code here  
)  
}

esClient.close()

this piece of code is existing in an application (whose process is always up).  
The connection is getting established for the first time that we run this, but if we try to run the second time (without killing the application) it fails with  
Failed to initialize connection: None of the configured nodes were available [{uhAnU8f}{uhAnU8fuSU23apQDfGCPXA}{BXaLbIxSSeWiL6tqAbHpMg}{127.0.0.1}{127.0.0.1:9330}]

But when I restart the entire process, the connection is successful for first time and fails the second time.  
i.e the connection is only lasting for one bulk insert, if i try to re-establish the connection after closing, it fails with no configured nodes available.  
Is there any other way other than esClient.close() to close the client or any other ways to open..

---

<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:** [September 8, 2017, 3:07pm UTC](https://discuss.elastic.co/t/failed-to-initialize-connection-none-of-the-configured-nodes-were-available/96790/2 "2017-09-08T15:07:11Z")

</div>

Closed on September 8, 2017, 3:07pm UTC

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