-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Property OnRequestDataCreated is missing from ElasticsearchClientSettings #8525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @mathiasaap , this callback does not seem to exist in the 8.x branch and should be removed from the documentation. Is there anything specific you want to achieve? Happy to help finding an alternative solution. |
Hey @flobernd , thanks for following up We’re using JWT authentication, but also need to include an ES-Client-Authentication header with a pre-shared secret for each request. We don’t want to set this value using GlobalHeaders, since that would require recreating the Elastic client whenever the secret rotates. Instead, we’d like to add the header dynamically to every request. OnRequestDataCreated seems like a good fit for this. Is there a simpler or more standard way to achieve dynamic per-request headers, without having to implement and maintain a custom IRequestInvoker or HttpMessageHandler? |
Hi @mathiasaap , would it work for you to set this header as part of the request? await client.SearchAsync<Person>(x => x
.Query(...)
.RequestConfiguration(x => x.GlobalHeaders(/* these headers are actually local / per-request, and not global */))); Instead of a descriptor, I will check if we can re-introduce something like the |
Thanks for the suggestion. While this approach works technically, it introduces awkwardness by mixing setup and usage concerns. We’ll implement a workaround for now, but having something like an OnRequestDataCreated hook would greatly improve the ability to centralize configuration. |
@mathiasaap I'll see what I can do! |
Elastic.Clients.Elasticsearch version: 8.18.0
Elasticsearch version: 8.18.1
.NET runtime version: 8
Description of the problem including expected versus actual behavior:
The property OnRequestDataCreated is missing from the class ElasticsearchClientSettings, but should be available according to the documentation: https://www.elastic.co/docs/reference/elasticsearch/clients/dotnet/_options_on_elasticsearchclientsettings
Steps to reproduce:
This following code should compile, but does not because OnRequestDataCreated does not exist
The text was updated successfully, but these errors were encountered: