elastic-transport-python
elastic-transport-python copied to clipboard
Use path_prefix to compute base_url in httpx
Currently, the path_prefix configuration (i.e. the url path) of the ES host is removed by the httpx client. This PR adds it.
path_prefix is set by client_utils.url_to_node_config (https://github.com/elastic/elastic-transport-python/blob/main/elastic_transport/client_utils.py#L187). It is either "" if the url path is empty or "/", or the url path itself.
For example, if you configure host to be http://localhost:9092/test and run a search() query, you'll see an HTTP request sent to http://localhost:9092/_search, without the "test" prefix.
This is very useful when elastic endpoints are behind a reverse proxy with a specific path.
💚 CLA has been signed
Thank you! Can you please sign the CLA?
Hi! Sorry for the delay. I just signed the CLA.
By the way, do you think this commit could be backported to 8.x?