Reputation: 5033
In an ASP.NET application. What would be the advised usage of the ElasticClient: once per application, once per request or just create & destroy when necessary?
What are implications towards caching, warming up, ...?
Is there any part of the documentation that goes into this? I've read a few statements online that cache is per AppDomain, but I would like to find out more details about this area of NEST.
Upvotes: 3
Views: 1129
Reputation: 13536
The client is stateless so whether you register it as a singleton or instantiate a new object functionally should not matter.
The only big but to this rule is when you introduce IConnectionPool
this has some internal state dealing with known nodes and should be registered as a singleton.
All the caching bits are per appdomain (static) no matter how you register, instantiate the clients.
Upvotes: 2