refresh() public method

Refresh status object.
public refresh ( )
Example #1
0
 public function testAliasExists()
 {
     $indexName = 'test';
     $aliasName = 'elastica_test-alias';
     $index1 = $this->_createIndex();
     $status = new Status($index1->getClient());
     foreach ($status->getIndicesWithAlias($aliasName) as $tmpIndex) {
         $tmpIndex->removeAlias($aliasName);
     }
     $this->assertFalse($status->aliasExists($aliasName));
     $index1->addAlias($aliasName);
     $status->refresh();
     $this->assertTrue($status->aliasExists($aliasName));
 }
Example #2
0
 /**
  * @group functional
  */
 public function testAliasExists()
 {
     $aliasName = 'elastica_test-alias';
     $index1 = $this->_createIndex();
     $indexName = $index1->getName();
     $status = new Status($index1->getClient());
     foreach ($status->getIndicesWithAlias($aliasName) as $tmpIndex) {
         $tmpIndex->removeAlias($aliasName);
     }
     $this->assertFalse($status->aliasExists($aliasName));
     $index1->addAlias($aliasName);
     $status->refresh();
     $this->assertTrue($status->aliasExists($aliasName));
     $indicesWithAlias = $status->getIndicesWithAlias($aliasName);
     $this->assertEquals(array($indexName), array_map(function ($index) {
         return $index->getName();
     }, $indicesWithAlias));
 }
Example #3
0
 public function testDeleteIndexDeleteAlias()
 {
     $indexName = 'test';
     $aliasName = 'test-aliase';
     $client = $this->_getClient();
     $index = $client->getIndex($indexName);
     $index->create(array(), true);
     $index->addAlias($aliasName);
     $status = new Status($client);
     $this->assertTrue($status->indexExists($indexName));
     $this->assertTrue($status->aliasExists($aliasName));
     // Deleting index should also remove alias
     $index->delete();
     $status->refresh();
     $this->assertFalse($status->indexExists($indexName));
     $this->assertFalse($status->aliasExists($aliasName));
 }
 /**
  * Refresh elastica status
  */
 protected function refreshStatus()
 {
     if ($this->status) {
         $this->status->refresh();
     }
 }