4.milvus索引FLAT

FLAT索引

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

使用Attu创建FLAT索引

python代码通过pymilvus创建FLAT索引

python 复制代码
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()
相关推荐
IT_Octopus13 小时前
springboot milvus search向量相似度查询 踩坑使用经验
spring boot·milvus
无极低码3 天前
基于deepseek的智能语音客服【第四讲】封装milvus数据库连接池封装
数据库·人工智能·milvus·连接池·向量数据库·向量化
seetimee3 天前
Milvus WeightedRanker 对比 RRF 重排机制
人工智能·python·milvus
锅巴胸4 天前
从零开始搭建向量数据库:基于 Xinference 和 Milvus 的文本搜索实践
milvus·xinference
louisliao_19814 天前
Milvus学习整理
学习·milvus
锅巴胸5 天前
基于 Milvus 和 BiomedBERT 的医学文献智能搜索系统
python·milvus
maxmaxma5 天前
LLM之向量数据库Chroma milvus FAISS
数据库·milvus·faiss
余子桃5 天前
docker安装向量数据库Milvus及可视化工具 Attu
docker·容器·milvus
探模之翼5 天前
《实战指南:基于Linux环境部署与应用Milvus向量数据库》
linux·数据库·milvus