When to Use HNSW
Basic Configuration
HNSW Parameters
Understanding the Parameters
M (Max Connections)
Controls the number of connections each node has in the graph.efConstruction
Controls build-time quality. Higher values = better graph structure but slower indexing.efSearch
Controls search-time quality. Can be adjusted per-query:Performance Characteristics
Build Time
Search Time
Memory Usage
HNSW adds approximately 50-100 bytes per document for graph connections on top of the embedding storage.Recall vs Speed Trade-offs
Incremental Updates
HNSW supports incremental updates without full rebuilds:Persistence with HNSW
The HNSW index structure is persisted along with embeddings:Tuning Guidelines
For Real-Time Search Applications
For High-Precision Applications
For Memory-Constrained Environments
Related
Search
Search options
Persistence
Storage adapters
Overview
Getting started