How does Elasticsearch work?

I am new to Elasticsearch, I am using Elasticsearch for my application. My application 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 throughout the application and is destroyed when the application exits. I do not close the client anywhere. Recently I ran into the "No Node Available" problem. I tried to dig into this and found that some people talk about closing the connection every time after any operation. So my question is, how does the Java client work? Does it create a connection to the cluster and save it (until timeout if specified) for reuse, or every time it tries to create a new connection?

+3


source to share





All Articles