Inheritance: extends Elastica\Client, implements Cake\Datasource\ConnectionInterface
コード例 #1
0
 /**
  * Returns an empty array as a shim for fixtures
  *
  * @return array An empty array
  */
 public function listTables()
 {
     try {
         $index = $this->connection->getIndex();
         $mappings = $index->getMapping();
     } catch (ResponseException $e) {
         return [];
     }
     return array_keys($mappings);
 }
コード例 #2
0
 /**
  * Truncate the fixture type.
  *
  * @param \Cake\ElasticSearch\Datasource\Connection $db The Elasticsearch
  *  connection
  * @return void
  */
 public function truncate(Connection $db)
 {
     $query = new MatchAll();
     $index = $db->getIndex();
     $type = $index->getType($this->table);
     $type->deleteByQuery($query);
     $index->refresh();
 }