我以前经常使用Milvus1.0。通过使用get_collection_stats和list_id_in_segment API,我可以从Milvus1.0获得所有I。
这些天我正在尝试Milvus2.0。我还想从Milvus2.0获得所有ID。但我找不到任何办法。
发布于 2022-03-08 18:50:44
Milvusv2.0.x支持使用布尔表达式的查询。
可以通过检查字段是否大于零来返回is。
让我们假设您正在为您的集合使用此模式。
参考资料:https://github.com/milvus-io/pymilvus/blob/master/examples/hello_milvus.py
截至2022年8月3日
fields = [
FieldSchema(name="pk", dtype=DataType.INT64, is_primary=True, auto_id=False),
FieldSchema(name="random", dtype=DataType.DOUBLE),
FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=dim)
]
schema = CollectionSchema(fields, "hello_milvus is the simplest demo to introduce the APIs")
hello_milvus = Collection("hello_milvus", schema, consistency_level="Strong")记得先把一些东西插入你的收藏中..。参见pymilvus示例。
在这里,您需要查询所有ids (pk)
当前无法列出特定于段的in,但这将返回集合中的所有in。
res = hello_milvus.query(
expr = "pk >= 0",
output_fields = ["pk", "embeddings"]
)
for x in res:
print(x["pk"], x["embeddings"])我认为这是现在唯一的方法,因为他们删除了list_id_in_segment
https://stackoverflow.com/questions/71252876
复制相似问题