[WIP] #3527 Improving Elasticsearch extension

The background story of this PR is here https://github.com/yiisoft/yii2/issues/3527