欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 培训 > 4.milvus索引FLAT

4.milvus索引FLAT

2025/12/18 2:46:53 来源:https://blog.csdn.net/qq_36352889/article/details/146486643  浏览:    关键词:4.milvus索引FLAT

FLAT索引

  • 暴力搜索,召回率100%,全表扫描。
  • FLAT不压缩向量,是唯一保证精确搜索结果的索引。
  • FLAT是准确的,采用了穷尽的搜索方法
  • FLAT也是最慢的索引。并不适合查询大量向量数据。
  • FLAT索引不需要任何参数。
  • 使用它不需要数据训练。
  • 创建FLAT索引瞬间完成,创建其他类型的索引需要耗费一定的时间。

使用Attu创建FLAT索引

python代码通过pymilvus创建FLAT索引

from pymilvus import (connections,Collection
)collection_name = "test_collection"
host = "192.168.171.130"
port = 19530
username = ""
password = ""connections.connect("default", host=host, port=port, user=username, password=password)
collection = Collection(collection_name, consistency_level="Bounded", shards_num=1)
index_params = {"index_type": "FLAT","metric_type": "L2","params": {}
}
collection.create_index(field_name="embeddings",index_params=index_params,index_name="idx_em"
)
print("done")# collection加载到内存
collection.load()

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词