/** * @author Martin Lonsky (martin@lonsky.net, +420 736 645876) * @return \Elasticsearch\Client */ public function getElasticSearchClient() { if ($this->_elasticsearch instanceof \Elasticsearch\Client) { return $this->_elasticsearch; } $this->_elasticsearch = $this->_elasticsearch_builder->build(); $this->_elasticsearch_builder = null; return $this->_elasticsearch; }
/** * This is run when the service provider is registered with Silex. * * @param Application $app The Silex application which has the configuration data. * * @return void */ public function register(Application $app) { $this->elasticsearch->setHosts([$app['elasticsearch.url']]); $this->client = $this->elasticsearch->build(); $app['elasticsearch'] = $this; }