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
How to modify http headers sent with an elasticsearch request? #407
Comments
Currently there is no direct way to inject your own headers. What I recommend is to subclass the connection class and modify the headers there:
Unfortunately there is no easy way to do this on a per-api basis. Hope this helps. |
Thanks for the response! This method will probably be fine. Cheers! |
NameError: global name 'self' is not defined |
@gibbon88 yes, I forgot the |
Thanks for the snippet @honzakral For anyone looking at this in future, I modified his code to allow sending a custom header with a value set at request time:
|
I've searched the documentation/internet and cannot find an answer to this question. How do I pass in extra headers to http requests in say methods like
elasticsearch.Elasticsearch.search
? Well really it would be most convenient if I could just do it once at say instantiation ofelasticsearch.Elasticsearch
...How is this most easily achieved?
The text was updated successfully, but these errors were encountered: