As Flask-Elasticsearch already exists: https://github.com/kazoup/flask-elasticsearch/blob/master/flask_elasticsearch.py, we can use it and move the current code to a module. Perhaps in a second step.