Skip to main content
Version: User Guides (BYOC)

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

You can modify collection-level properties after a collection is created.

Supported properties

Property

Description

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.

dynamicfield.enabled

Enables the dynamic field for collections that were created without enabling it. Once enabled, you can insert entities with fields not defined in the original schema. For details, refer to Dynamic Field.

Example 1: Set collection TTL

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}
)

Example 2: Enable mmap

The following code snippet demonstrates how to enable mmap.

from pymilvus import MilvusClient

client.alter_collection_properties(
collection_name="my_collection",
properties={"mmap.enabled": True}
)

Example 3: Enable partition key

The following code snippet demonstrates how to enable the partition key.

from pymilvus import MilvusClient

client.alter_collection_properties(
collection_name="my_collection",
properties={"partitionkey.isolation": True}
)

Example 4: Enable dynamic field

The following code snippet demonstrates how to enable the dynamic field.

from pymilvus import MilvusClient

client.alter_collection_properties(
collection_name="my_collection",
properties={"dynamicfield.enabled": True}
)

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"
]
)