Best practice working with Client


I'm wondering, in case we have to make an exhaustive use of ES, if it is better to create the Client (with TransportClient.builder) in every request or to have a kind of Factory, with a pool of Clients already initialized and ready to use.

In other words... of expensive is to create a Client on every request if we have a few (10-20) requests per second, always to the same index?

Thanks in advance!

Singleton. Use a factory yes.

1 Like

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