Cake\ElasticSearch\Datasource\Connection::getIndex PHP Method

getIndex() public method

Returns the index for the given connection
public getIndex ( string $name = null ) : Index
$name string Index name to create connection to, if no value is passed it will use the default index name for the connection.
return Elastica\Index Index for the given name
    public function getIndex($name = null)
    {
        return parent::getIndex($name ?: $this->getConfig('index'));
    }

Usage Example

 /**
  * 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);
 }
All Usage Examples Of Cake\ElasticSearch\Datasource\Connection::getIndex