Qdrant 向量数据库
Qdrant 是 Rust 编写的向量数据库,支持 payload 过滤、混合检索、量化和分布式部署。REST 端口 6333,gRPC 端口 6334。适合语义搜索、推荐和 RAG。
启动单节点:
docker run -d --name qdrant \
-p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_storage:/qdrant/storage \
qdrant/qdrant
创建集合:
curl -X PUT http://localhost:6333/collections/docs \
-H 'Content-Type: application/json' \
-d '{"vectors":{"size":1536,"distance":"Cosine"}}'
写入向量:
curl -X PUT 'http://localhost:6333/collections/docs/points' \
-H 'Content-Type: application/json' \
-d '{"points":[{"id":1,"vector":[0.1,0.2],"payload":{"source":"faq"}}]}'
搜索并过滤:
curl -X POST 'http://localhost:6333/collections/docs/points/search' \
-H 'Content-Type: application/json' \
-d '{"vector":[0.1,0.2],"limit":5,"filter":{"must":[{"key":"source","match":{"value":"faq"}}]}}'
创建快照:
curl -X POST http://localhost:6333/collections/docs/snapshots
合上页面,先回答,再展开对照。