# How to connect from python to an elasticsearch cluster?

**URL:** <https://discuss.elastic.co/t/how-to-connect-from-python-to-an-elasticsearch-cluster/225251>\
**Category:** Elasticsearch\
**Created:** [March 26, 2020, 5:24pm UTC](https://discuss.elastic.co/t/how-to-connect-from-python-to-an-elasticsearch-cluster/225251 "2020-03-26T17:24:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GGUERRA](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@GGUERRA](https://discuss.elastic.co/u/GGUERRA)\
**Post date:** [March 26, 2020, 5:24pm UTC](https://discuss.elastic.co/t/how-to-connect-from-python-to-an-elasticsearch-cluster/225251/1 "2020-03-26T17:24:54Z")

</div>

Hi everyone!

I have an elasticsearch cluster, one virtual machine per node and everything works fine. I want to connect to the cluster using python, I understand that there is a library and I have been reading it, but all the examples indicate how to connect to a single node, and I want to be sure that I am connecting to the entire cluster and not just to one node. Does anyone have an example of how to connect from python to elasticsearch, considering that it is a cluster with several nodes?

Any help would be appreciated, thanks in advance!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 23, 2020, 5:25pm UTC](https://discuss.elastic.co/t/how-to-connect-from-python-to-an-elasticsearch-cluster/225251/2 "2020-04-23T17:25:06Z")

</div>

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