# Vector search

> Canonical: https://skillalmanac.com/glossary/vector-search | Last verified: 2026-11-25 | Index status: index-eligible

Vector search finds items whose numerical representations, called vectors or embeddings, lie closest to the vector of a query, so results can match meaning instead of exact keywords. Large collections usually use approximate nearest neighbor methods.

Also called: vector similarity search, vector search engine, approximate nearest neighbor, ANN search, nearest neighbor search, embedding search.

## In plain language

Ordinary search looks for the words you typed. Vector search looks for things that mean something similar. Text, images or other items are first turned into lists of numbers called vectors, and your question is turned into one too. The system then returns the stored items whose numbers sit nearest to the question's numbers, like finding the closest pins to your pin on a map. A query about a pizza place can find a page about a recommended restaurant that never uses those words. The limit is that the nearest numbers are not always the right answer: results depend on the model that made the vectors, and exact names, codes or rare terms can be missed. Searching huge collections often trades a little accuracy for speed.

## Technical definition

Vector search represents the query and stored items in a compatible vector space; separately parameterized question and passage encoders can be trained into such a space, as in Dense Passage Retrieval. It ranks items by a distance or similarity measure such as Euclidean distance or cosine similarity, as IBM describes. Comparing the query with every stored vector is slow at scale, so approximate nearest neighbor (ANN) indexes are used. HNSW, described by Malkov and Yashunin, builds a multi-layer graph of nested subsets of the stored elements and starts a search from the upper layer, in the abstract's words. The Faiss library paper describes a library that provides indexing methods and tools for searching, clustering, compressing and transforming vectors, and presents vector similarity search as a core function of vector databases.

## How it shows up when you use agents

When an agent answers from a large pile of documents, the step that finds the passages is often a vector search. Your text was split into chunks, each chunk was turned into an [embedding](/glossary/embedding), and the question is matched against them. That is the core of [retrieval-augmented generation](/glossary/retrieval-augmented-generation). A [vector database](/glossary/vector-database) is one place such an index can live, and [semantic search](/glossary/semantic-search) is the user-facing idea of searching by meaning.

Most coding agents find code differently: they search file names and text, then read whole files. If you add an MCP server or a plugin that offers "search my docs", ask what it does underneath. A vector index needs an embedding model, a store and a refresh step when files change.

What breaks when this is misunderstood: people trust the top result because it ranks first. Nearest in vector space means similar in the embedding model's sense, and exact identifiers, error codes or new product names can be missed. One option is [hybrid search](/glossary/hybrid-search), which mixes keyword and vector results; IBM says vector search can be integrated into hybrid search approaches. A next action is to log the top few results for your failing questions and read them before changing the prompt or the model.

## Common confusions

- **Vector search versus keyword search.** Keyword search matches the terms you typed. Vector search compares embeddings, so it can match meaning without shared words. It can also miss an exact term that a keyword search would find.
- **Vector search versus vector database.** Vector search is the operation. A vector database is one kind of system that stores vectors and runs it; the Faiss paper describes a library for the same operation.
- **Exact versus approximate.** Exact nearest-neighbor search returns the nearest items under the chosen metric. Exhaustive comparison is one exact method; exact tree search can prune branches. According to IBM, approximate methods such as HNSW trade some exactness for speed.
- **Myth.** Vector search understands the question. It compares numbers produced by a model, and the quality of the match depends on that model and on the data that was indexed.

## Worked examples in this catalogue

### [What Is RAG? Retrieval-Augmented Generation Explained](https://skillalmanac.com/learn/what-is-rag)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The guide walks through indexing and querying, then a worked chunking example in which a sentence stored alone loses the company and quarter it belongs to.

Why it exercises the concept: The guide illustrates a common RAG query phase using vector search over stored chunks; other RAG systems can use lexical or hybrid retrieval. The guide shows what that step finds, and how chunking changes what it can find.

### [rag-chunking-planner](https://skillalmanac.com/skills/skill-almanac/rag-chunking-planner)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Your documents split by three chunking strategies, with defects and offline recall reported for each, so chunk settings are chosen with numbers.

Why it exercises the concept: Vector search can only return what was indexed. The skill measures the chunking step that decides what the index contains, before you tune the search itself.

### [library-docs-lookup](https://skillalmanac.com/skills/skill-almanac/library-docs-lookup)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: An answer to a library question drawn from the installed package's own files, with file and line cited.

Why it exercises the concept: A contrast case for a coding agent. It retrieves from the installed files, and its description does not say it uses vectors. It shows retrieval in a coding setting; many agents find code by text match, not by vector search.

## Related terms

- [Vector database](https://skillalmanac.com/glossary/vector-database.md)
- [Embedding](https://skillalmanac.com/glossary/embedding.md)
- [Semantic search](https://skillalmanac.com/glossary/semantic-search.md)
- [Retrieval-augmented generation (RAG)](https://skillalmanac.com/glossary/retrieval-augmented-generation.md)
- [Cosine similarity](https://skillalmanac.com/glossary/cosine-similarity.md)
- [Hybrid search](https://skillalmanac.com/glossary/hybrid-search.md)

## Sources

- [What is vector search?](https://www.ibm.com/think/topics/vector-search), IBM (accessed 2026-11-24)
- [Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs](https://arxiv.org/abs/1603.09320), arXiv (Malkov and Yashunin) (accessed 2026-11-24)
- [The Faiss library](https://arxiv.org/abs/2401.08281), arXiv (Douze et al.) (accessed 2026-11-24)
- [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/html/2004.04906v3), Karpukhin et al. (arXiv) (accessed 2026-11-25)
- [scipy.spatial.KDTree.query](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.query.html), SciPy (accessed 2026-11-25)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
