set_properties()
Near Deprecation此操作为 Collection 设置属性。
请求语法
python
set_properties(
properties: dict,
timeout: float | None,
kwargs
)
参数:
-
properties (dict) -
以字典形式提供的一组 Collection 属性。目前,您可以设置以下属性:
-
collection.ttl.seconds
设置此属性后,当前 Collection 中的数据会在指定时间后过期。Collection 中已过期的数据将被清理,且不会参与搜索或查询。
-
mmap.enabled
是否在 Collection 级别启用内存映射存储。更多信息,请参见 配置内存映射。
-
-
timeout (float) -
此操作的超时时长。将其设置为 None 表示当收到任何响应或发生任何错误时,此操作即超时。
返回类型:
NoneType
返回值:
None
示例
python
from pymilvus import Collection, CollectionSchema, FieldSchema, DataType
schema = CollectionSchema([
FieldSchema("id", DataType.INT64, is_primary=True),
FieldSchema("vector", DataType.FLOAT_VECTOR, dim=5)
])
# Create a collection
collection = Collection(
name="test_collection",
schema=schema
)
# Set the TTL for the data in the collection
collection.set_properties(
properties={
"collection.ttl.seconds": 60
}
)
相关操作
以下操作与 insert() 相关: