Skip to main content
Version: User Guides (Cloud)

Modify Collection

You can rename a collection or change its settings. This page focuses on how to modify a collection.

Rename Collection

You can rename a collection as follows.

from pymilvus import MilvusClient

client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN"
)

client.rename_collection(
old_name="my_collection",
new_name="my_new_collection"
)

Set Collection Properties

The following code snippet demonstrates how to set collection TTL.

from pymilvus import MilvusClient

client.alter_collection_properties(
collection_name="my_collection",
properties={"collection.ttl.seconds": 60}
)

The applicable collection properties are as follows:

Property

When to Use

collection.ttl.seconds

If the data of a collection needs to be deleted after a specific period, consider setting its Time-To-Live (TTL) in seconds. Once the TTL times out, Zilliz Cloud deletes all entities from the collection. The deletion is asynchronous, indicating that searches and queries are still possible before the deletion is complete. For details, refer to Set Collection TTL.

mmap.enabled

Memory mapping (Mmap) enables direct memory access to large files on disk, allowing Zilliz Cloud to store indexes and data in both memory and hard drives. This approach helps optimize data placement policy based on access frequency, expanding storage capacity for collections without impacting search performance.

Zilliz Cloud implements global mmap settings for your clusters. You can change the settings on a specific field or its index.

For details, refer to Use mmap.

partitionkey.isolation

With Partition Key Isolation enabled, Zilliz Cloud groups entities based on the Partition Key value and creates a separate index for each of these groups. Upon receiving a search request, Zilliz Cloud locates the index based on the Partition Key value specified in the filtering condition and restricts the search scope within the entities included in the index, thus avoiding scanning irrelevant entities during the search and greatly enhancing the search performance. For details, refer to Use Partition Key Isolation.

Drop Collection Properties

You can also reset a collection property by dropping it as follows.

client.drop_collection_properties(
collection_name="my_collection",
property_keys=[
"collection.ttl.seconds"
]
)