milvus-logo
LFAI
Home
  • User Guide

Modify a collection

This topic describes how to modify the properties, especially the time to live (TTL), of a collection.

Currently, the TTL feature is only available in Python.

When interacting with Milvus using Python code, you have the flexibility to choose between PyMilvus and MilvusClient (new). For more information, refer to Python SDK.

collection.set_properties(properties={"collection.ttl.seconds": 1800})

The example above changes the collection TTL to 1800 seconds.

ParameterDescriptionOption
Properties: collection.ttl.secondsCollection time to live (TTL) is the expiration time of data in a collection. Expired data in the collection will be cleaned up and will not be involved in searches or queries. Specify TTL in the unit of seconds.The value should be 0 or greater. The default value is 0, which means TTL is disabled.

What's next