Our search code works on either Elasticsearch 1 or Elasticsearch 6. However, all deployments are still tied to ES1 because of these two lines in requirements.txt:
elasticsearch==2.1.0 elasticsearch-dsl<2.0.0
To use Elasticsearch 6 those two lines would need to be changed to this:
elasticsearch>6.0.0,<7.0.0 elasticsearch-dsl>6.0.0,<7.0.0
We can't support both in a single release because a given virtual environment can't have two versions of the same Python package installed.
However, when you install a Docker image, you can specify certain values for environment variables. We could use an environment variable to control which versions of these packages were installed.
Let's call the environment variable ELASTICSEARCH_VERSION. We would check it in simplified_app.sh. If it's set to "6" then after running "pip install -r requirements.txt" we would run "pip install -r requirements_es6.txt". If it's set to some other value, or not set at all, we would run "pip install -r requirements_es1.txt".-
At some point in the future we would switch the polarity, so that if you don't specify ELASTICSEARCH_VERSION it installs version 6. At some point beyond that we would remove this code completely and go back to having a single requirements.txt file.