I am using an ElasticSearch (elasticsearch==7.0.2
) client in Python
from elasticsearch import Elasticsearch
client = Elasticsearch({
"host": "https://my-first-deployment.es.southamerica-east1.gcp.elastic-cloud.com",
"port": 9200
})
I took the hostname from my first deployment in ElasticSearch, Copy Endpoint:
But it doesn't seem to work
socket.gaierror: [Errno -3] Temporary failure in name resolution
What am I missing?
EDIT: I don't know what port it should be and I don't know where to check it. I assumed it is 9200 because it is the default port when running locally.
I am pretty sure your port is incorrect and you should probably remove https://
from the host name, put it into an array and somehow indicated that it should use ssl. I think it might be much easier to just use the entire endpoint in this format:
client = Elasticsearch(["https://my-first-deployment.es.southamerica-east1.gcp.elastic-cloud.com:12345"],
http_auth=("elastic", "<password>"),
)
Alternatively, you can just copy cluster id and use it like this:
es = Elasticsearch(
cloud_id="cluster-1:dXMa5Fx...",
http_auth=("elastic", "<password>"),
)
Note: I'm assuming your username is elastic
.
Also, what's your deployment version? If it is 8.x you should probably switch to corresponding version of python client.