When I set up a connection to my ElasticSearch cluster using ElasticSearch.NET, I am using a code block like the following:
var uris = settingsProvider.ElasticSearchUri.Split(';').Select(x => new Uri(x));
var sniffingConnectionPool = new SniffingConnectionPool(uris);
var connectionConfiguration =
new ConnectionConfiguration(sniffingConnectionPool)
.SniffOnConnectionFault()
.SniffOnStartup();
var client = new ElasticsearchClient(settings: connectionConfiguration);
Is it recommended that I memoize/make static/make a singleton wrapper for the ElasticsearchClient
, the ConnectionConfiguration
, or the SniffingConnectionPool
so that they don't have to be reconstructed each time I search?