Elastica\Status::aliasExists PHP Method

aliasExists() public method

Checks if the given alias exists.
public aliasExists ( string $name ) : boolean
$name string Alias name
return boolean True if alias exists
    public function aliasExists($name)
    {
        return count($this->getIndicesWithAlias($name)) > 0;
    }

Usage Example

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));
 }
All Usage Examples Of Elastica\Status::aliasExists