Home › RAG & vector DBs › Qdrant vector search rules

Qdrant vector search rules

Cursor rules for Qdrant collections: vector config, payload indexes, filtered search, hybrid vectors, and snapshots.

CursorRAG & vector DBs

How to use

Save this as .cursor/rules/qdrant.mdc in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.cursor/rules/qdrant.mdcDownload  
---
description: Qdrant vector search conventions
globs: ["**/*.py","**/*.ts"]
alwaysApply: false
---

# Qdrant

- One `QdrantClient` (or `AsyncQdrantClient` in async apps) per process; URL and API key from env. Local dev via `docker run -p 6333:6333 qdrant/qdrant` pinned to a version.
- Create collections in a setup/migration script, not on the request path: `vectors_config` with size matching the model and `distance=Cosine` (or Dot for normalized vectors).
- Use named vectors when storing more than one embedding (e.g. `dense` and `sparse` for hybrid search with BM25/SPLADE).
- Create payload indexes for every field used in filters (`create_payload_index(field_name="tenant_id", field_schema="keyword")`). Mark the tenant field with `is_tenant=True` for multitenant collections.
- Point ids are UUIDs or integers derived deterministically from `docId + chunk` so re-ingest upserts in place.
- Search with `query_points(..., query=vector, query_filter=Filter(must=[...]), limit=k, with_payload=[...])`; return only needed payload fields.
- Hybrid: use the Query API `prefetch` for dense + sparse and fuse with `FusionQuery(fusion=Fusion.RRF)`.
- Upsert in batches (`upload_points` with `parallel`), `wait=True` only in tests.
- Enable scalar/binary quantization for large collections and rescore for accuracy.

## Don't
- Don't delete collections or drop payload fields in shared environments without approval.

## Done when
Integration tests run against a local Qdrant container and filtered search returns only the caller's tenant data.

More: all RAG & vector DBs rules · all Cursor rules

Related rules

pgvector rules

Cursor rules for vector search in PostgreSQL with pgvector: column types, HNSW indexes, filtering, and hybrid queries.

CursorRAG & vector DBs

Pinecone vector database AGENTS.md

AGENTS.md for apps using Pinecone serverless indexes: namespaces, metadata filters, upserts, and integrated embedding.

AGENTS.mdRAG & vector DBs

RAG pipeline CLAUDE.md

CLAUDE.md for retrieval-augmented generation apps: chunking, embeddings, hybrid search, citations, and RAG evals.

Claude Code (CLAUDE.md)RAG & vector DBs

Jupyter notebook hygiene rules

Cursor rules for Jupyter notebooks in data projects: reproducible cells, small outputs, and moving code into modules.

CursorPython Data & ML

LangGraph agent rules

Cursor rules for building agents with LangGraph in Python: typed state, nodes, tools, checkpointers, and tests.

CursorLLM apps & agents

OpenAI Agents SDK rules

Cursor rules for the OpenAI Agents SDK (Python 0.2x): agents, function tools, handoffs, guardrails, sessions, and tracing.

CursorLLM apps & agents

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.