Production patterns for Qdrant vector search, distilled from running 380M+ vectors in production.
Each pattern is a self-contained, runnable Python file with inline comments explaining the why behind each decision.
| File | What it covers |
|---|---|
01_hnsw_tuning.py |
HNSW parameter selection, RAM estimation, ef at search time |
02_geo_filtered_search.py |
Geo-filtered ANN search — payload geo index + radius filter |
03_batch_upsert.py |
Bulk upload with chunking, retry and backpressure |
04_snapshot_s3.py |
Collection backup: snapshot -> download -> S3 -> restore |
05_payload_indexing.py |
Keyword/integer payload indexes for fast filtered search |
pip install -r requirements.txt
# Start Qdrant locally
docker run -p 6333:6333 qdrant/qdrant
python patterns/01_hnsw_tuning.pyHNSW m and ef_construct — see docs/hnsw_guide.md for a tuning guide with RAM estimates and recall tradeoffs.
Geo index before search — Qdrant evaluates payload filters before touching the HNSW graph. Without a geo index, geo filtering is O(n) full scan. With it, matching candidates are resolved in the index first, then ANN runs only on them.
Snapshots over re-embedding — creating a snapshot of a live collection takes seconds and produces a portable file. Restoring from snapshot is 10-100x faster than re-embedding from scratch. Back up daily, seed new instances from snapshots.
Payload indexes are selective — only index fields you filter on in queries. Each index adds RAM and write overhead. High-cardinality ID fields don't benefit from indexing.
Qdrant 1.9+, Python 3.12+