Vector index
A vector index is a data structure that makes similarity search fast by avoiding a full scan. By default Ahnlich compares your query against every stored vector; a vector index pre-structures the vectors so only a fraction need to be checked.
Ahnlich offers two approaches, from exact-but-linear to approximate-but-fast:
- Exact search — no index; always exact, but cost grows with the store.
- HNSW — approximate, scales to high-dimensional embeddings.
Choosing an index
| Situation | Use |
|---|---|
| Small store, or you need exact results | Exact scan (no index) |
| Large store of high-dimensional embeddings | HNSW |
An index costs extra memory and build time, and approximate indexes (HNSW) trade a little recall for speed — so add one when search latency actually matters.
Adding a vector index
Create one with Create non-linear index (or seed it at store creation); remove it with Drop non-linear index.
Filtering by metadata instead of vectors? That's a different structure — see predicate indexes.