/** * @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']); }
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(); } }
/** * 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']; }
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']; }