メインコンテンツまでスキップ

drop_alias()

Addedv2.3.x

This operation drops a specified collection alias.

📘Notes

This method applies only to dedicated serving clusters and on-demand compute.

  • For a managed collection in serving clusters, please create MilvusClient with the cluster endpoint.

  • Free & Serverless

https://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com

  • Dedicated

https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

  • For an external collection for on-demand compute, create MilvusClient with the project endpoints.

https://{project-id}.{region}.api.zillizcloud.com

Request syntax

drop_alias(
alias: str,
timeout: float | None
) -> None

PARAMETERS:

  • alias (str) -

    [REQUIRED]

    The alias of a collection.

    Before this operation, ensure that the alias exists. Otherwise, exceptions will occur.

  • timeout (float | None)

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURN TYPE:

NoneType

RETURNS:

None

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation, especially when you set alias to a non-existing alias.

  • BaseException

    This exception will be raised when this operation fails.

Example

from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password"
)

# 2. Create a collection
client.create_collection(collection_name="test_collection", dimension=5)

# 3. Create an alias for the collection
client.create_alias(collection_name="test_collection", alias="test")

# 4. Drop the alias
client.drop_alias(alias="test")