Closed francoisv100 closed 11 months ago
Hello, thanks for the feature request! This is something I would like to add in the future, but for now the client only works without a path.
Thanks I have downgraded to version 7.17 for now to get connectivity working again.
I didn't realize this used to work, thanks for the information.
This issue may also affect our published getting started instructions. In those instructions, it says to copy the URL from the cloud console and that URL is returned without a path and without a port. (ex: https://https://my-cool-cluster.es.europe-west9.gcp.elastic-cloud.com
)
As a result, following the instructions we provide for getting started with the Python client results in the following stacktrace:
ValueError: URL must include a 'scheme', 'host', and 'port' component (ie 'https://localhost:9200')
@francoisv100 While trying to work on this issue, I realized we already implement this, and found your mistake:
es = Elasticsearch('https://api.elkserver.co.za/elastic/v1:443', ...)
Parsing this url gives:
https
api.elkserver.co.za
/elastic/v1:443
(!)The URL should be https://api.elkserver.co.za:443/elastic/v1
instead. Now this goes back to @cachedout's comment where it is annoying to have to specify the port for the HTTPS endpoint. It was on my TODO list and I just opened https://github.com/elastic/elastic-transport-python/pull/127 to make 443 the default HTTPS port. This will be relased as elastic-transport 8.11.0.
Thanks for the feedback , updated my side and its working now,
es = Elasticsearch('https://api.elkserver.co.za:443/elastic/v1', headers={"v_token": v_token}, timeout=120, verify_certs=False)
@francoisv100 Good to know!
For the record, elastic-transport 8.11.0 is out with the fix to default to port 443 for HTTPS endpoints. So if you upgrade, you won't need to specify the port anymore.
When adding a path in the url a Value Error is raised and connection fails to the remote elk host , url without a path initiates a connection , but in our setup we require the path to be included when initiating the connection,
Python Code used with elasticsearch version 8.10
Without a path in the url , connection gets initiated , can ignore the index error