Пример #1
0
 /**
  * Returns array of indexes which are mapped to given alias
  *
  * @param string $aliasName Alias name
  * @return array
  */
 private function getAliasedIndexes(Client $client, $aliasName)
 {
     $aliasesInfo = $client->request('_aliases', 'GET')->getData();
     $aliasedIndexes = array();
     foreach ($aliasesInfo as $indexName => $indexInfo) {
         $aliases = array_keys($indexInfo['aliases']);
         if (in_array($aliasName, $aliases)) {
             $aliasedIndexes[] = $indexName;
         }
     }
     return $aliasedIndexes;
 }
Пример #2
0
 public function request($path, $method = Request::GET, $data = array(), array $query = array())
 {
     try {
         return parent::request($path, $method, $data, $query);
     } catch (ExceptionInterface $e) {
         if ($this->_logger) {
             $this->_logger->warning('Failed to send a request to ElasticSearch', array('exception' => $e->getMessage(), 'path' => $path, 'method' => $method, 'data' => $data, 'query' => $query));
         }
         return new Response('{"took":0,"timed_out":false,"hits":{"total":0,"max_score":0,"hits":[]}}');
     }
 }