Python client send data to Elastic cloud refused

Hello,

I have been sending data to my localhost (elastic 7.12) easily with Python.

I'm trying to do the same with elastic cloud with the following command :

es = Elasticsearch(
cloud_id='my_cloud_id_from_https://cloud.elastic.co/deployments/my_id',
http_auth=('elastic', 'mypassword'), port=443)

helpers.bulk(es, some_data)

I have the following error :

ConnectionError: ConnectionError(<urllib3.connection.HTTPSConnection object at 0x0000021278455EB0>: Failed to establish a new connection: [WinError 10061] Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée) caused by: NewConnectionError(<urllib3.connection.HTTPSConnection object at 0x0000021278455EB0>: Failed to establish a new connection: [WinError 10061] Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée)

Sorry, some sentences are in french but basically, the connexion is refused.

Bonjour Erwan :slight_smile:

If you are using a localhost instance, I don't think you can use cloud_id in that case which is specific for an elasticsearch cluster running on cloud.
And I believe that localhost is the default value for this client so something like the following should work I think:

es = Elasticsearch(http_auth=('elastic', 'mypassword'))
helpers.bulk(es, some_data)

Is you local cluster secured?
If not, you can run this I think:

es = Elasticsearch()
helpers.bulk(es, some_data)

Hello,

I found the solution if it can help someone :
es = Elasticsearch( cloud_id='cluster-1:my_cluster_id_from_https://cloud.elastic.co/deployments', http_auth=('user', 'password'), port=443 ) helpers.bulk(es, some_data)`

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.