@param $index
@param $alias
@param array $aliasParameters

@return bool
@see https://www.elastic.co/guide/en/elasticsearch/reference/2.0/indices-aliases.html#alias-adding
168039
public function addAlias($index, $alias, $aliasParameters = [])
    {
        return (bool)$this->db->put([$index, '_alias', $alias], [], json_encode((object)$aliasParameters));
    }
573365
public static function hasAlias(string $alias): bool
    {
        // empty OR not an alias
        if (!$alias || $alias[0] !== '@') {
            return false;
        }

        return isset(self::$aliases[$alias]);
    }
776427
public static function setAlias($alias, $identifier)
    {
        $identifier = self::getIdentifier($identifier);
        self::$_aliases[$alias] = $identifier;
    }
1165728
public static function alias($name, $alias = null)
    {
        // get real name for $id
        if (null === $alias) {
            return self::resolveAlias($name);
        }

        foreach ((array)$alias as $aliasName) {
            if (!isset(self::$aliases[$aliasName])) {
                self::$aliases[$aliasName] = $name;
            }
        }

        return true;
    }
814572
def set_alias(index_name, delete=True):
    '''
    
    '''
    log.info('Creating alias "{0}" on index "{1}"'.format(
        es.index_name, index_name))
    if es.indices.exists_alias(name=es.index_name):
        alias = es.indices.get_alias(name=es.index_name)
        previous_indices = alias.keys()
        if index_name not in previous_indices:
            es.indices.put_alias(index=index_name, name=es.index_name)
        for index in previous_indices:
            if index != index_name:
                es.indices.delete_alias(index=index, name=es.index_name)
                if delete:
                    es.indices.delete(index=index)
    else:
        es.indices.put_alias(index=index_name, name=es.index_name)
1075100
public static function getRouteByAlias($alias)
    {
        //No routes
        if (empty(self::$routes)) {
            return;
        }

        //Search in the map
        $route = null;

        if (($index = array_search($alias, array_column(self::$routes, 'alias'))) !== false) {
            $route = self::$routes[$index]['route'];
        }

        return $route;
    }
590314
public function getIndexInfoByAlias($alias)
    {
        $responseData = $this->db->get(['_alias', $alias]);
        if (empty($responseData)) {
            return [];
        }

        return $responseData;
    }
186407
public function createAlias($reference, $alias = null)
    {
        //if reference is array look for array(alias=>reference);
        if (is_array($reference)) {
            foreach ($reference as $key => $class) {
                $this->createAlias($class, $key);
            }

            return true;
        }

        //store in this->alias as an associative array of class to an array of aliases;
        foreach ((!is_array($alias) ? [$alias] : $alias) as $key) {
            $this->aliases[$key] = $reference;
        }
    }
53122
public function hasTableAlias($alias)
    {
        return $this->hasAlias($alias) && $this->getExpression($this->getHash($alias)) instanceof Expr\Table;
    }
670124
public int swapIndex(final String index,
                       final String alias) throws IndexException {
    //IndicesAliasesResponse resp = null;
    try {
      /* index is the index we were just indexing into
       */

      final IndicesAdminClient idx = getAdminIdx();

      final GetAliasesRequestBuilder igarb = idx.prepareGetAliases(
              alias);

      final ActionFuture<GetAliasesResponse> getAliasesAf =
              idx.getAliases(igarb.request());
      final GetAliasesResponse garesp = getAliasesAf.actionGet();

      final ImmutableOpenMap<String, List<AliasMetaData>> aliasesmeta =
              garesp.getAliases();

      final IndicesAliasesRequestBuilder iarb = idx.prepareAliases();

      final Iterator<String> it = aliasesmeta.keysIt();

      while (it.hasNext()) {
        final String indexName = it.next();

        for (final AliasMetaData amd: aliasesmeta.get(indexName)) {
          if(amd.getAlias().equals(alias)) {
            iarb.removeAlias(indexName, alias);
          }
        }
      }

      iarb.addAlias(index, alias);

      final ActionFuture<IndicesAliasesResponse> af =
              idx.aliases(iarb.request());

      /*resp = */af.actionGet();

      return 0;
    } catch (final ElasticsearchException ese) {
      // Failed somehow
      error(ese);
      return -1;
    } catch (final IndexException ie) {
      throw ie;
    } catch (final Throwable t) {
      throw new IndexException(t);
    }
  }
1031720
public function addAlias($routeName, $alias)
    {
        if(is_array($alias))
            foreach($alias as $item)
                $this->aliasIndices[$item] = $routeName;
        else
            $this->aliasIndices[$alias] = $routeName;

        return $this;
    }
810612
@Deprecated
    public static void createAlias(Client client, String alias, String index) throws Exception {
        logger.trace("createAlias({},{})", alias, index);
        AcknowledgedResponse response = client.admin().indices().prepareAliases().addAlias(index, alias).get();
        if (!response.isAcknowledged()) throw new Exception("Could not define alias [" + alias + "] for index [" + index + "].");
        logger.trace("/createAlias({},{})", alias, index);
    }
1162406
protected static function parameter($alias)
    {
        if (isset(Yii::$app->params[self::className()]) && is_array(Yii::$app->params[self::ClassName()]) ) {
            static::$_params = ArrayHelper::merge(
                static::$_params
              , Yii::$app->params[self::className()]
            );
        }
        return static::$_params[$alias];
    }
767424
public function addAlias($alias, array $target)
    {
        $this->alias[$alias] = isset($this->alias[$alias]) ? array_merge($this->alias[$alias], $target) : $target;

        if (in_array($alias, $this->types)) {
            return;
        }
        $this->types[] = $alias;

    }
844425
public function hasSubqueryAlias($alias)
    {
        return $this->hasAlias($alias) && $this->getExpression($this->getHash($alias)) instanceof Expr\Subquery;
    }
744136
def add_alias(self, alias, indices, **kwargs):
        
        indices = self.conn._validate_indices(indices)

        return self.change_aliases(['add', index, alias,
                                    self._get_alias_params(**kwargs)]
                                    for index in indices)
849362
public function updateAliases(array $aliasActions)
    {
        if (!isset($aliasActions['actions'])) {
            throw new RepositoryException('Actions key is missing');
        }

        $request = $this->createRequestInstance(self::INDEX_UPDATE_ALIASES, null, null);
        $request->setBody($aliasActions);

        return $this->client->send($request);
    }