protected function initElastic()
{
$this->di->setShared('elastic', function () {
/**
* @var DiInterface $this
* @var Config $config
*/
$config = $this->getShared('config')->get('elasticsearch', new Config());
$hosts = $config->get('hosts', new Config())->toArray();
if (empty($hosts)) {
// Fallback
$hosts = ['127.0.0.1:9200'];
}
return new ElasticClient(['hosts' => $hosts]);
});
}