What is Vector Search?
Vector search finds the stored items whose meaning is closest to your query's meaning — its nearest neighbors in the embedding space.
Explain like I'm new to AI
Once everything is an embedding (a point on the "meaning map"), searching becomes a geometry problem: which stored points are closest to my query's point?
That's vector search. You embed the query, then find its nearest neighbors among all the stored vectors. Move the query below and watch the nearest results change:
Click the grid to move your query. The 3 nearest points light up.
The red dot is your query; the highlighted dots are its nearest neighbors — the results vector search returns.
Mental model
Drop your question as a pin on the meaning map. Vector search hands you the nearest pins — the most semantically similar items — ranked by closeness.
How it works
- Every item is stored as a vector.
- The query is embedded into a vector.
- The system computes similarity (e.g. cosine) between the query and stored vectors.
- It returns the top-k closest matches.
Because comparing against millions of vectors exactly is slow, real systems use an approximate nearest neighbor (ANN) index like HNSW to stay fast.
Real-world example
A documentation site embeds every paragraph. When you search "my app keeps crashing on startup," vector search returns paragraphs about "application fails to launch" — closest in meaning, even with entirely different wording.
Technical explanation
Exact nearest-neighbor search is O(n) per query — you compare against every stored vector. ANN indexes trade a tiny bit of accuracy (recall) for massive speed, enabling low-latency search over huge collections. Key parameters: k (how many results), the similarity metric (must match how the embeddings were trained), and index settings that balance recall vs. latency. Vector search is the retrieval engine behind RAG, recommendations, and deduplication.
Common mistakes
Ignoring recall. Approximate search can miss relevant results if the index is tuned purely for speed. Measure retrieval quality against a known set — don't assume it.
- Using a different similarity metric than the embedding model expects.
- Requesting too small a k for RAG, starving the model of useful context.
When to use it
- Semantic search and the retrieval step of a RAG system; recommendations and near-duplicate detection.
When NOT to use it
- When exact keyword matching is required and sufficient — use full-text search, or combine both as hybrid search.
Alternatives
- Keyword/full-text search (lexical); hybrid search fuses lexical and vector results.
Quick quiz
Related concepts
- What is a Vector Database? — A vector database stores embeddings and finds the most similar ones fast, making it the memory layer behind semantic search and RAG.
- Similarity: Cosine, Dot Product & Euclidean — Similarity metrics measure how close two embedding vectors are; cosine similarity compares direction, dot product adds magnitude, and Euclidean measures distance.
- Exact vs Approximate Nearest Neighbor — Exact search compares every vector and is always right but slow; approximate (ANN) search checks a smart subset for huge speed with a small recall trade-off.
Last reviewed: 2026-09-01 · Written by ByHeart AI · Reviewed by ByHeart AI