Skip to content

Core concepts ​

The vocabulary of duckdb-vectors, defined once, in plain words. Other pages link here instead of redefining these terms. To see them at work, follow the five-minute quickstart.

One file, one index ​

An index is a single DuckDB file, vectors.duckdb by default. It holds everything that search needs: the text of the chunks, their metadata and their embeddings. There is no server to run. Copy the file, and you have copied the index. Bake it into a container image, and the agent carries its knowledge base with it.

Chunks and metadata ​

Indexing reads your files and splits them into chunks. A chunk is a passage of text, small enough to be a useful answer, such as one section of a Markdown page or one page of a PDF. Each chunk keeps its source file, its title and its metadata. The metadata comes from the front matter of the page, for example kind: policy, and is returned with every hit. You can also use it to filter a search.

Embeddings and model choice ​

An embedding is a list of numbers that places a chunk, or a question, on a map of meaning. Chunks that talk about the same thing land close together, even when they share no word. The embedding model draws that map. The default model is small, runs on your machine and works offline, so the index stays compact and the first search needs no account. A larger local model, a model from Hugging Face or a cloud model trade speed and file size for relevance. Choose the model by name when you index, and use the same one when you search. The user guide lists the choices.

A search runs two methods, then merges their results.

  • By meaning. The question is embedded, and the closest chunks win. This finds a paraphrase.
  • By exact token. A keyword search, called BM25, finds chunks that contain the very same words. It does not stem words and does not know any language, so acronyms, codes and identifiers match as written.

Each method ranks the chunks. The two rankings are fused by rank, with Reciprocal Rank Fusion, so that a chunk that both methods like rises to the top. Every hit carries its score. The reasons for these choices are in the architecture and in Frequent questions.

Build then freeze, or append at runtime ​

There are two ways to fill an index.

  • Build then freeze. Index a folder when you build, then open the file read-only when the agent runs. This suits a corpus that changes at each release. See Set up a RAG agent.
  • Runtime append. Open the store for writing when the agent starts, and add items, for example a registry of tools or skills. See Search over skills.

A DuckDB file has a single writer, so keep writes to one process. Any number of readers can follow, one at a time.

SDK, CLI and MCP ​

The same index answers through three doors.

  • The SDK. VectorStore is the Python class that your harness calls. Use it when your code owns the agent.
  • The CLI. The duckdb-vectors command has the verbs index, report and search. Use it to build an index and to check it by hand.
  • MCP. duckdb-vectors mcp serves the tools search and report over the Model Context Protocol, on standard input and output. Use it when an editor or an agent runtime launches the server for you.

Glossary ​

  • Chunk — a passage of text, with its source, title and metadata, that is indexed and returned as a unit.
  • Index — the DuckDB file that holds chunks, metadata and embeddings.
  • Embedding — a fixed-size list of numbers that represents the meaning of a text.
  • Hybrid search — a search that fuses a ranking by meaning with a ranking by exact token.
  • BM25 — the keyword ranking that scores how well a chunk matches the words of the question.
  • RRF — Reciprocal Rank Fusion, the way two rankings are merged into one by rank.
  • DuckDB — an in-process analytical database engine that runs inside the Python process.
  • ARRAY — the DuckDB fixed-size list column type that stores an embedding, for example FLOAT[384] for 384 dimensions.
  • VSS — the DuckDB vector similarity search extension, with HNSW indexing. It is optional here.
  • FTS — the DuckDB full-text search extension that provides BM25 scoring.
  • markdown extension — a DuckDB community extension that parses Markdown into SQL rows.
  • Front matter — the block of key-value pairs at the top of a Markdown page. It becomes the metadata of the chunks.
  • Harness — the agent framework or runtime that calls the search.
  • MCP — the Model Context Protocol, which lets a client call tools served by another process.

Next steps ​