A vector index in OpenSearch must return very accurate nearest neighbors with low query latency, and the team can afford more memory. Which index type fits?
- Exam domain
- Data Store Management26% of the exam
- Difficulty
- Hard
- In this mock
- 23 questions on this domainPractise this domain
Why the exam asks this
Task Statement 2.1: Choose a data store.
Objective in the exam guide: Apply storage services to appropriate use cases (for example, using indexing algorithms like HNSW); describe vector index types (for example, HNSW, IVF).
Vector search now sits inside many data platforms. Choosing the index type sets the balance between accuracy, speed and memory cost.
Why A is the answer
HNSW, a graph-based approximate nearest neighbor index
HNSW gives high recall and fast queries at the cost of more memory; IVF trades some recall for less memory.
Remember: Accuracy and speed with memory to spare: HNSW. Tight memory: IVF.
How it works
Vector indexes find approximate nearest neighbors without comparing a query with every vector.
HNSW builds a multi-layer graph that is navigated quickly, giving high recall and low latency, but it uses more memory.
IVF groups vectors into clusters and searches only the closest clusters, which uses less memory but can miss some neighbors.
Clues in the question
The words that point to the answer, and what each one tells you.
- Very accurate, low latency
- High recall and speed: HNSW.
- Can afford more memory
- HNSW's main cost is acceptable.
In detail
- HNSW (Hierarchical Navigable Small Worlds) builds a layered graph of vectors.
- IVF (inverted file) groups vectors into clusters and searches only the nearest clusters.
Side by side with look-alikes
| Index | Recall | Memory |
|---|---|---|
| HNSW | High | Higher |
| IVF | Good, tunable | Lower |
| No index (exact) | Exact | Low, but slow |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. HNSW, a graph-based approximate nearest neighbor indexRight
Accuracy and speed with memory to spare: HNSW. Tight memory: IVF.
B. IVF, chosen to save memory at some cost to recallWrongMost tempting
IVF saves memory, but the team wants maximum accuracy and can afford memory.
Why it tempts: IVF is a real and popular index type. But it trades accuracy for memory, the opposite of this team's priority.
C. No index, scanning every vector on each queryWrong
A full scan is exact but far too slow at scale.
D. A B-tree index on the vector columnWrong
B-trees index ordered values, not similarity between vectors.
In practice
- Measure recall on a labeled query set before choosing.
Use case
An illustrative scenario, not a real incident.
A search team picks HNSW for its 20 million product vectors after measuring recall, and adds memory to the cluster.
See how it works
quadrantChart x-axis Less memory --> More memory y-axis Lower recall --> Higher recall quadrant-1 High recall, costly quadrant-2 Ideal but rare quadrant-3 Cheap, less accurate quadrant-4 Avoid HNSW: [0.78, 0.88] IVF: [0.3, 0.6]
How to read this chart
- Across: memory the index needs. Up: how often it finds the true nearest neighbors.
- HNSW sits top right: high recall, more memory.
- IVF sits lower left: less memory, with some loss of recall.