# Python module - use master nodes or data nodes?

**URL:** <https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [May 24, 2021, 3:54pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848 "2021-05-24T15:54:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [May 24, 2021, 3:54pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848/1 "2021-05-24T15:54:45Z")

</div>

When using python bulk load should I open connection with master node or data node?

`elastic_output = Elasticsearch([master1,master2], http_auth=(elastic_admin_user, elastic_admin_passwd),port=9200)`

and then write data

`helpers.bulk(elastic_output, mylist)`

both of the above it working. if I use one master, one data or multiple.

But want to know which one is better? because I believe it is only opening connection to one random node from list.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 24, 2021, 11:39pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848/2 "2021-05-24T23:39:45Z")

</div>

If they are dedicated masters, then you should not be using them.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [May 25, 2021, 1:00pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848/3 "2021-05-25T13:00:00Z")

</div>

they are not. they are co-ordinating master.

but regardless of that question is should I use one data node or one co-ordinating master.  
cluster has five data node, three master and two co-ordinating master.  
I was using all data node in logstash config file.

but do not how python uses multiple server name

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 25, 2021, 10:58pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848/4 "2021-05-25T22:58:28Z")

</div>

Just use all 5 nodes then, it should be ok with smaller clusters.

---

<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:** [June 22, 2021, 10:59pm UTC](https://discuss.elastic.co/t/python-module-use-master-nodes-or-data-nodes/273848/5 "2021-06-22T22:59:10Z")

</div>

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