milvus的delete操作
milvus版本:v2.3.2
milvus支持delete操作。
使用python sdk代码如下:
代码语言:python代码运行次数:0复制from pymilvus import (
connections,
Collection,
)
print("start connecting to Milvus")
connections.connect("default", host="192.168.230.71", port="19530")
hello_milvus = Collection("hello_milvus")
print("Start delete entities")
expr = "pk in [446576772095935668,446576772095935667]"
delete_result = hello_milvus.delete(expr)
print(delete_result)
不管pk是否存在都会返回对应的数量:
(insert count: 0, delete count: 2, upsert count: 0, timestamp: 446577115426193409, success count: 0, err count: 0)
这里例子指定了2个id需要删除,如果这2个id不存在,【delete count】也会返回2。