本文整理匯總了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;
}