LuckyLuke
LuckyLuke

Reputation: 49097

Where to close an Elasticsearch client connection?

Where should I close the connection to a client for Elasticsearch? I am using Spring, and I don't want to use the Elasticsearch integration because I want to learn how to do it without first. Should only one client be created for the application? Meaning that it would have singleton scope? Or should it have prototype scope and close the connection for each interaction?

Upvotes: 1

Views: 4373

Answers (1)

imotov
imotov

Reputation: 30163

You should use one client per application, make it a singleton and close on application shutdown.

Upvotes: 5

Related Questions