I'm a newbie to Elasticsearch, I'm using Elasticsearch for my app. My app has the following code to interact with ES.
- Client (Singleton)
if(client==null) {
client = new TransportClient().addTransportAddress(new InetSocketTransportAddress(host,port.toInteger()))
}
This client is used in throughout the app and destroyed on the shutdown of the app. I don't close the client anywhere else. Recently, I started facing "No Node Available" exception. I tried digging into that and found some people talking about closing the connection every time after any operation. So my question is, how does the Java client actually work? Does it create a connection with the cluster and keep it alive (till the timeout if specified) to be reused or every time it tends to create new connection?