本文整理汇总了PHP中Elasticsearch\ClientBuilder::build方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientBuilder::build方法的具体用法?PHP ClientBuilder::build怎么用?PHP ClientBuilder::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elasticsearch\ClientBuilder
的用法示例。
在下文中一共展示了ClientBuilder::build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getElasticSearchClient
/**
* @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;
}
示例2: register
/**
* 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;
}