Skip to main content
Enable HNSW (Hierarchical Navigable Small World) for datasets above roughly 10,000 documents. HNSW provides sub-millisecond queries with more than 95% recall.

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:
For very large bulk loads (100,000+ documents), consider disabling HNSW during import and enabling it after, then rebuilding the index.

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

Search

Search options

Persistence

Storage adapters

Overview

Getting started