1

I am trying to get the data from Elasticsearch (ver. 1.7), and post it into Elasticsearch (ver. 5.2) using Elasticsearch-py with 1 Python script. But the recommended way within official docummentation (https://elasticsearch-py.readthedocs.io/en/master/) is:

Elasticsearch 5.x for elasticsearch>=5.0.0,<6.0.0

Elasticsearch 1.x for elasticsearch>=1.0.0,<2.0.0

The question is how may I install 2 different versions of elasticsearch-py and use those within 1 Python script (I'm using virtualenv)?


I've already checked all the questions like: Installing multiple versions of a package with pip , here are some ideas suggested, but is there some better way to achieve this?

1 Answer 1

1

how about that

pip install -t old oldelasticsearch
pip install -t new newelasticsearch

and then you should be able to import it like this

from old import elasticsearch
from new import elasticsearch
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the answer, but this gives ImportError: No module named <directory where I stored package>
(venv) magniff@magniffy700:~/workspace/venv $ pip install -t es_new elasticsearch==5.0.0 and then just python -c 'from es_new import elasticsearch as es_new'. Works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.