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()
相关推荐
第十昵称2 小时前
[milvus-backup]milvus-standalone跨服务器迁移
milvus
第十昵称1 天前
milvus-standalone跨服务器迁移-local
milvus
SXJR17 天前
spring boot + langchain4j +milvus实现向量存储
java·spring boot·后端·大模型·milvus·rag·langchain4j
救救孩子把17 天前
11 Milvus-HNSW原理与实战
milvus
救救孩子把17 天前
13 Milvus-混合检索HybridSearch
milvus
海天一色y17 天前
深入理解 RAG 技术:从语义张量到向量数据库,Milvus 与 FAISS 全面对比
数据库·milvus·faiss
小饕18 天前
RAG学习之【向量数据库】Milvus 从入门到精通:索引、检索、混合搜索一篇打通(RAG 必备)
数据库·人工智能·学习·milvus
SilentSamsara18 天前
向量数据库实战:Chroma/Milvus/Qdrant 选型与语义搜索应用
开发语言·数据库·人工智能·python·青少年编程·milvus
救救孩子把18 天前
06 Milvus-Collection设计
milvus
沪漂阿龙18 天前
Vector Store:FAISS、Chroma、Milvus、Qdrant、ES 怎么选?
人工智能·elasticsearch·架构·milvus·faiss