Olia
Olia

Reputation: 811

Different version of Elasticsearch-py lib within Python script

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?

Upvotes: 1

Views: 1101

Answers (1)

hello world
hello world

Reputation: 624

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

Upvotes: 1

Related Questions