Revert "Simplify Elasticsearch initialization"

This reverts commit 68eacf5a5d45f0ece0f184dd5e74909f27daaeab.