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()
相关推荐
Rick19931 天前
Milvus 基本原理
milvus
Cosolar2 天前
万字详解:RAG 向量索引算法与向量数据库架构及实战
数据库·人工智能·算法·数据库架构·milvus
梵得儿SHI2 天前
(第四篇)Spring AI 架构设计与优化:真实生产环境复盘,从 100ms 到 10ms 的响应提速全流程
人工智能·缓存·性能优化·milvus·向量检索·rag·spring ai
Muyuan19984 天前
29.从 FAISS 到 Milvus:给我的 RAG Agent 项目加一层可替换的向量检索后端
fastapi·milvus·faiss
AIGC包拥它4 天前
RAG 项目实战进阶:基于 FastAPI + Vue3 前后端架构全面重构 LangChain 0.3 集成 Milvus 2.5 构建大模型智能应用
人工智能·python·重构·vue·fastapi·milvus·ai-native
My_Java_Life4 天前
windows中使用docker部署Milvus和Autt
windows·docker·milvus
渣渣苏5 天前
硬核拆解 HNSW:亿级向量如何实现毫秒级召回?(上篇)
人工智能·算法·支持向量机·ai·向量数据库·hnsw·智能体
渣渣苏5 天前
硬核拆解 HNSW:亿级向量如何实现毫秒级召回?(下篇:实战调参与工程优化)
人工智能·算法·agent·向量数据库·hnsw·智能体
霸道流氓气质6 天前
基于 Milvus Lite 的 Spring AI RAG 向量库实践方案与示例
人工智能·spring·milvus
隔窗听雨眠6 天前
基于Milvus混合检索与Java SpringBoot的全栈实现
milvus