Vector Indexing
Qdrant supports two vector index types:Plain Index (No Index)
Brute-force search through all vectors:Plain indexes guarantee 100% precision but are only practical for small collections (less than 10K vectors).
HNSW Index
Hierarchical Navigable Small World - the default index for fast approximate search:HNSW Algorithm
HNSW builds a multi-layer graph structure for efficient approximate nearest neighbor search:How HNSW Works
- Graph Construction: Vectors are organized into a hierarchical graph with multiple layers
- Entry Point: Search starts at the top layer with a single entry point
- Greedy Traversal: At each layer, navigate to the closest neighbor until a local minimum is found
- Descend: Move down to the next layer and repeat
- Bottom Layer: Final refinement at the bottom layer with all vectors
Key Parameters
M - Connectivity
Number of bidirectional links per node:Higher M means more connections, better quality, but more memory and slower search.
ef_construct - Build Quality
Number of candidates evaluated during construction:ef - Search Quality
Number of candidates evaluated during search (runtime parameter):Higher hnsw_ef improves recall but slows down search. Adjust per-query based on quality requirements.
full_scan_threshold
When to use brute-force instead of HNSW:For queries filtering down to few vectors, brute-force is faster than HNSW graph traversal. This threshold automatically switches strategies.
Index Storage
In-Memory HNSW
Fastest option - entire index in RAM:On-Disk HNSW
Reduces memory usage for large indexes:Payload Indexing
Payload indexes enable fast filtering:Keyword Index
For exact match filtering:Integer Index
For numeric exact match and range queries:Text Index
For full-text search:Geo Index
For geographic queries:Bool Index
For boolean filtering:Optimization Process
Qdrant automatically optimizes segments over time:Segment Types
Optimization Strategy
- Plain Segments: New points go into plain (unindexed) segments for fast writes
- Threshold: When segment reaches threshold size, optimization is triggered
- Index Building: Optimizer builds HNSW index in background
- Replacement: Old plain segment is replaced with new indexed segment
Optimization runs in the background without blocking reads or writes.
Quantization
Reduce memory usage with vector quantization:Scalar Quantization
Convert float32 to int8:Product Quantization
Split vectors into sub-vectors:Binary Quantization
1-bit quantization:Search Optimization
ACORN Search
Improves recall for filtered searches:Exact Search
Disable approximate search:Performance Tuning
For High Throughput
For High Accuracy
For Large Scale
Best Practices
Index all filtered fields
Index all filtered fields
Create indexes for every payload field you filter on. Unindexed filters are extremely slow.
Balance M and ef_construct
Balance M and ef_construct
Start with defaults (M=16, ef_construct=100). Increase M for better recall, ef_construct for better index quality.
Tune hnsw_ef per use case
Tune hnsw_ef per use case
Use lower hnsw_ef (32-64) for latency-critical applications, higher (128-256) for accuracy-critical applications.
Use quantization for large collections
Use quantization for large collections
Quantization dramatically reduces memory usage with minimal accuracy loss. Start with scalar quantization.
Monitor optimization status
Monitor optimization status
Check collection status to ensure optimization is completing successfully.
Consider on-disk for large datasets
Consider on-disk for large datasets
If your vectors don’t fit in RAM, use on-disk HNSW and quantization.
Related Concepts
Collections
Learn how to configure indexes at collection creation
Vectors
Understand what gets indexed
Payloads
Learn about payload indexes
Distance Metrics
Understand distance calculations in indexed search