Skip to content
Github

Indexers

VortexDB supports multiple indexing algorithms, each optimized for different use cases. The index determines how vectors are organized for similarity search.

The Flat index performs brute-force exhaustive search by computing distances to every vector.

  • Dataset size: < 10,000 vectors
  • Requirements: Need exact/guaranteed results
  • Use cases: Testing, prototyping, small production workloads
Terminal window
INDEX_TYPE=flat

The KD-Tree (k-dimensional tree) is a space-partitioning data structure that recursively divides the vector space.

At each level, the tree splits data along a different dimension (cycling through x, y, z, …).

  • Vector dimensions: < 20 dimensions
  • Dataset size: Thousands to hundreds of thousands of vectors
  • Use cases: Geographic data, low-dimensional embeddings, spatial queries
Terminal window
INDEX_TYPE=kdtree

HNSW (Hierarchical Navigable Small World) is a state-of-the-art approximate nearest neighbor algorithm based on proximity graphs. It constructs a multi-layered graph where each layer represents a different level of granularity, enabling efficient navigation from coarse to fine-grained similarity search.

Check out this blog post for more theoretical details and this blog covering implementation in VortexDB.

  • Vector dimensions: Any, but especially > 20 dimensions
  • Dataset size: 100,000+ vectors
  • Use cases: Semantic search, recommendation systems, RAG applications
Terminal window
INDEX_TYPE=hnsw

All indexes support four distance/similarity metrics:

Measures the angle between two vectors, ignoring magnitude.

d=1ABABd = 1 - \frac{A \cdot B}{\|A\| \|B\|}

  • Range: 0 (identical) to 2 (opposite)
  • Best for: Text embeddings, normalized vectors
similarity=Similarity.COSINE

Use this decision tree:

VectorsDimensionsRecommended Index
< 10,000AnyFlat
10K - 100K< 20KD-Tree
10K - 100K≥ 20HNSW
> 100KAnyHNSW
Terminal window
# For a semantic search application with OpenAI embeddings
DIMENSION=1536
INDEX_TYPE=hnsw
STORAGE_TYPE=rocksdb
# For a small prototype with sentence-transformers
DIMENSION=384
INDEX_TYPE=flat
STORAGE_TYPE=inmemory