private function getAliasedIndex(Client $client, $aliasName)
    {
        $aliasesInfo = $client->request('_aliases', 'GET')->getData();
        $aliasedIndexes = [];

        foreach ($aliasesInfo as $indexName => $indexInfo) {
            if ($indexName === $aliasName) {
                throw new AliasIsIndexException($indexName);
            }
            if (!isset($indexInfo['aliases'])) {
                continue;
            }

            $aliases = array_keys($indexInfo['aliases']);
            if (in_array($aliasName, $aliases)) {
                $aliasedIndexes[] = $indexName;
            }
        }

        if (count($aliasedIndexes) > 1) {
            throw new \RuntimeException(sprintf(
                'Alias %s is used for multiple indexes: [%s]. Make sure it\'s'.
                'either not used or is assigned to one index only',
                $aliasName,
                implode(', ', $aliasedIndexes)
            ));
        }

        return array_shift($aliasedIndexes);
    }
private function getAliasedIndex(Client $client, $aliasName)
    {
        $aliasesInfo = $client->request('_aliases', 'GET')->getData();
        $aliasedIndexes = [];

        foreach ($aliasesInfo as $indexName => $indexInfo) {
            if ($indexName === $aliasName) {
                throw new AliasIsIndexException($indexName);
            }
            if (!isset($indexInfo['aliases'])) {
                continue;
            }

            $aliases = array_keys($indexInfo['aliases']);
            if (in_array($aliasName, $aliases)) {
                $aliasedIndexes[] = $indexName;
            }
        }

        if (count($aliasedIndexes) > 1) {
            throw new \RuntimeException(sprintf(
                'Alias %s is used for multiple indexes: [%s]. Make sure it\'s'.
                'either not used or is assigned to one index only',
                $aliasName,
                implode(', ', $aliasedIndexes)
            ));
        }

        return array_shift($aliasedIndexes);
    }
private function getAliasedIndex ( Client $ client , $ aliasName ) { $ aliasesInfo = $ client -> request ( '_aliases' , 'GET' ) -> getData ( ) ; $ aliasedIndexes = [ ] ; foreach ( $ aliasesInfo as $ indexName => $ indexInfo ) { if ( $ indexName === $ aliasName ) { throw new AliasIsIndexException ( $ indexName ) ; } if ( ! isset ( $ indexInfo [ 'aliases' ] ) ) { continue ; } $ aliases = array_keys ( $ indexInfo [ 'aliases' ] ) ; if ( in_array ( $ aliasName , $ aliases ) ) { $ aliasedIndexes [ ] = $ indexName ; } } if ( count ( $ aliasedIndexes ) > 1 ) { throw new \ RuntimeException ( sprintf ( 'Alias %s is used for multiple indexes: [%s]. Make sure it\'s' . 'either not used or is assigned to one index only' , $ aliasName , implode ( ', ' , $ aliasedIndexes ) ) ) ; } return array_shift ( $ aliasedIndexes ) ; }
Returns the name of a single index that an alias points to or throws
an exception if there is more than one.

@param Client $client
@param string $aliasName Alias name

@return string|null

@throws AliasIsIndexException
Returns the name of a single index that an alias points to or throws an exception if there is more than one .