I am connecting to elastic search using Elastic Search Transport Client. There are two approaches that I've tried
1) Singleton client shared across my entire application. Time to response is between 1-2s
2) New client instance for every call to Elastic Search, takes about 7s to respond. To be specific, there are 5 classes that need to connect the ES cluster and this approach creates a new Transport client for each class.
Is 1) a good approach to go ahead in terms of elastic search, as it is usually not recommended to have singleton db connection object?
Is there any connection pooling mechanism available for Elastic Search, like we have DBCP for relational databases?
Your client should be a singleton. source : http://elasticsearch-users.115913.n3.nabble.com/What-is-your-best-practice-to-access-a-cluster-by-a-Java-client-td4015311.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With