I connect to elastic search using the Elastic Search Transport Client. There are two approaches that I have tried
1) Singleton client, common to the entire application. Response time between 1-2 sec.
2) A new client instance for each Elastic Search call takes about 7 seconds to respond. To be specific, there are 5 classes that need to connect an ES cluster, and this approach creates a new transport client for each class.
Is 1) a good approach to search elastic search, since it is usually not recommended to have a singleton db connection object?
Is there any pooling mechanism for Elastic Search, for example, do we have DBCP for relational databases?
source
share