/** * @group functional */ public function testGetNodeNames() { $client = $this->_getClient(); $cluster = new Cluster($client); foreach ($cluster->getNodeNames() as $name) { $this->assertEquals('Elastica', $name); } }
public function testGetNodeNames() { $client = $this->_getClient(); $cluster = new Cluster($client); $names = $cluster->getNodeNames(); $this->assertInternalType('array', $names); $this->assertGreaterThan(0, count($names)); }
/** * @group functional */ public function testGetNodeNames() { $client = $this->_getClient(); $data = $client->request('/')->getData(); $cluster = new Cluster($client); $data = $client->request('/_nodes')->getData(); $rawNodes = $data['nodes']; $rawNodeNames = array(); foreach ($rawNodes as $rawNode) { $rawNodeNames[] = $rawNode['name']; } $this->assertEquals($rawNodeNames, $cluster->getNodeNames()); }
/** * Returns all index settings * * @return array Index settings */ public function getSettings() { // TODO Update as soon as new API is implemented $cluster = new Cluster($this->_index->getClient()); $state = $cluster->getState(); return $state['metadata']['indices'][$this->_index->getName()]['settings']; }
/** * Checks if the given index is already created * * @return bool True if index exists */ public function exists() { $cluster = new Cluster($this->getClient()); return in_array($this->getName(), $cluster->getIndexNames()); }