# Elasticsearch python client compatibility

**URL:** <https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 18, 2021, 2:09pm UTC](https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829 "2021-08-18T14:09:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruce289](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@bruce289](https://discuss.elastic.co/u/bruce289)\
**Post date:** [August 18, 2021, 2:09pm UTC](https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829/1 "2021-08-18T14:09:50Z")

</div>

Hi,

I need to write a python script that can be run against both elasticsearch 6 and elasticsearch 7 clusters. Which version of the python elasticsearch client would be recommended for this purpose?

Thanks,  
Bruce

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [August 18, 2021, 2:49pm UTC](https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829/2 "2021-08-18T14:49:21Z")

</div>

You can't use one client to talk to both version as there are breaking changes and API changes from 6.X to 7.X.

You will need to use the current one, named `elasticsearch` and the client to version 6, available as `elasticsearch6`.

```auto
pip install elasticsearch
pip install elasticsearch6

```

For more information about compatibility you can check the [documentation](https://elasticsearch-py.readthedocs.io/en/7.x/).

---

<div class="post-metadata">

**Author:** ![bruce289](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@bruce289](https://discuss.elastic.co/u/bruce289)\
**Post date:** [August 18, 2021, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829/3 "2021-08-18T15:50:34Z")

</div>

Thanks, Leandro. That makes sense. I know that logstash v6.8 and beats v6.8 are still compatible with v7 clusters so I was wondering if there was anything similar with the python client.

One question, if we go down the road of using the elasticsearch package for elasticsearch v7 clusters and elasticsearch6 for the v6 clusters, what happens when we upgrade the v6 clusters? We have to make sure the python clients are upgraded at exactly the same time?

---

<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:** [September 15, 2021, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-python-client-compatibility/281829/4 "2021-09-15T15:50:34Z")

</div>

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