You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We are facing an issue when running tests as different users (via token authentication). The Elastic client states it should be a singleton, however, there is only one chance upon initialisation of the Elastic client to define the connection settings. This means each time we run a test we have to create a new client with a new set of connection settings for the selected user to be tested on.
Describe the solution you'd like
A nice solution would be to configure the token used for each request. Or alternatively, making the Elastic client an IDisposable type.
Describe alternatives you've considered
For now, we are running these tests synchronously and relying on the garbage collector to "dispose" of these when the test has finished.
Additional context
none
The text was updated successfully, but these errors were encountered:
A nice solution would be to configure the token used for each request.
This is already possible:
varcreateIndexResponse=awaitclient.Indices.CreateAsync<Person>("index_name", c =>c// ....RequestConfiguration(x =>x.Authentication(newApiKey("..."))));
Or alternatively, making the Elastic client an IDisposable type.
The client itself is not disposable, the ElasticsearchClientSettings however is. All of the native resources like sockets etc. are managed by the ElasticsearchClientSettings and they should be released as soon as you dispose the settings.
I think this solves our problem... Thanks for the timely response. This is really neat though, I don't think we'll need to dispose of any client settings now we can configure tokens on specific requests.
Is your feature request related to a problem? Please describe.
We are facing an issue when running tests as different users (via token authentication). The Elastic client states it should be a singleton, however, there is only one chance upon initialisation of the Elastic client to define the connection settings. This means each time we run a test we have to create a new client with a new set of connection settings for the selected user to be tested on.
Describe the solution you'd like
A nice solution would be to configure the token used for each request. Or alternatively, making the Elastic client an IDisposable type.
Describe alternatives you've considered
For now, we are running these tests synchronously and relying on the garbage collector to "dispose" of these when the test has finished.
Additional context
none
The text was updated successfully, but these errors were encountered: