milvus-logo
LFAI
Home
  • User Guide

Collection Alias

This topic describes how to manage collection aliases. Milvus supports specifying a unique alias for a collection.

A collection alias is globally unique, hence you cannot assign the same alias to different collections. However, you can assign multiple aliases to one collection.

The following example is based on the alias publication.

Create a collection alias

Specify an alias for a collection.

from pymilvus import utility
utility.create_alias(
  collection_name = "book",
  alias = "publication"
)
await milvusClient.createAlias({
  collection_name: "book",
  alias: "publication",
});
// This function is under active development on the GO client.
milvusClient.createAlias(
  CreateAliasParam.newBuilder()
    .withCollectionName("book")
    .withAlias("publication")
    .build()
);
await milvusClient.CreateAliasAsync("book", "publication");
Parameter Description
collection_name Name of the collection to create alias on.
alias Collection alias to create.
Parameter Description
collection_name Name of the collection to create alias on.
alias Collection alias to create.
Parameter Description
CollectionName Name of the collection to create alias on.
Alias Collection alias to create.
Parameter Description
collectionName Name of the collection to create alias on.
alias Collection alias to create.

Drop a collection alias

Drop a specified alias.

from pymilvus import utility
utility.drop_alias(alias = "publication")
await milvusClient.dropAlias({
  alias: "publication",
});
client.DropAlias(context.Background(), "publication")
milvusClient.dropAlias(
  DropAliasParam.newBuilder()
    .withAlias("publication")
    .build()
);
await milvusClient.DropAliasAsync("publication");
Parameter Description
alias Collection alias to drop.
Parameter Description
alias Collection alias to drop.
Parameter Description
Alias Collection alias to drop.
Parameter Description
alias Collection alias to drop.
Parameter Description
alias Collection alias to drop.

Alter a collection alias

Alter an existing alias to another collection. The following example is based on the situation that the alias publication was originally created for another collection.

from pymilvus import utility
utility.alter_alias(
  collection_name = "book",
  alias = "publication"
)
await milvusClient.alterAlias({
  collection_name: "book",
  alias: "publication",
});
client.AlterAlias(context.Background(), "book", "publication")
milvusClient.alterAlias(
  AlterAliasParam.newBuilder()
    .withCollectionName("book")
    .withAlias("publication")
    .build()
);
await milvusClient.AlterAliasAsync("book", "publication");
Parameter Description
collection_name Name of the collection.
alias New alias
Parameter Description
collection_name Name of the collection
alias New alias
Parameter Description
CollectionName Name of the collection.
Alias New alias.
Option Description
collName Name of the collection.
alias New Alias
Parameter Description
collectionName Name of the collection
alias New Alias

Limits

FeatureMaximum limit
Length of an alias255 characters

What's next