本文整理汇总了PHP中Elasticsearch\Client::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::count方法的具体用法?PHP Client::count怎么用?PHP Client::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elasticsearch\Client
的用法示例。
在下文中一共展示了Client::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @Route("/")
* @Template("DashboardMainBundle:Default:index.html.twig")
*/
public function index()
{
$params = array();
$params['hosts'] = array('127.0.0.1:9200');
$client = new Elasticsearch\Client($params);
$params = array("index" => "dash-mail-*", "type" => "mail", "body" => array("query" => array("filtered" => array("filter" => array("bool" => array("must" => array(array("missing" => array("field" => "flags")), array("term" => array("folderFullName" => "INBOX")))))))));
$results_mail = $client->search($params);
$params = array("index" => "dash-rss-*", "type" => "page");
$results_rss = $client->count($params);
$params = array("index" => "dash-twitter-*", "type" => "status");
$results_twitter = $client->count($params);
return array("mail_unread" => $results_mail['hits']['total'], "rss_total" => $results_rss['count'], "twitter_total" => $results_twitter['count']);
}
示例2: count
public function count($params = [])
{
if (!isset($params['index'])) {
$params['index'] = $this->getSearchIndex();
}
$this->requestToScreen($params, 'COUNT');
try {
return parent::count($params);
} catch (\Exception $e) {
$this->registerErrorForException($e);
return array();
}
}
示例3: count
/**
* Returns the number of entities available.
* @return integer the number of entities
*/
public function count()
{
$result = $this->elasticsearchClient->count(array('index' => $this->index, 'type' => $this->getType()));
return $result['count'];
}
示例4: jobsCount
public function jobsCount(array $criteria, ElasticsearchClient $client, array $config)
{
$exportOptions = $this->buildExportOptions($criteria);
$component = 'orchestrator';
$filter = [];
$filter[] = ['term' => ['project.id' => $this->token->getProjectId()]];
$query = ['match_all' => []];
if ($exportOptions != null) {
$query = ['query_string' => ['allow_leading_wildcard' => 'false', 'default_operator' => 'AND', 'query' => $exportOptions]];
}
$params = [];
$params['index'] = $config['index_prefix'] . '_syrup_*';
if (!is_null($component)) {
$params['index'] = $config['index_prefix'] . '_syrup_' . $component;
}
$params['body'] = ['query' => ['filtered' => ['filter' => ['bool' => ['must' => $filter]], 'query' => $query]]];
$count = $client->count($params);
return $count['count'];
}