Analysis

What Is a Vector Database? From Meaning Search to a Working Product

A vector database helps software find similar meaning across text, images, and other data. Here is the plain-English mental model, the system behind it, and a practical path from prototype to reliable product.

By Adi

Published 16 min read
Source manuals break into small cards, become clusters of blue points, and produce three evidence candidates for a human to review before a response.

Share

Suppose a packaging line keeps stopping after the team changes carton sizes.

A technician searches the company’s maintenance library for “line stops after carton change.” The approved guide describes the same problem as “intermittent feed interruption following a format conversion.” A basic keyword search may miss the passage because the words differ. A vector search can retrieve it because an embedding model places the question and the passage near each other in its representation of meaning.

That sounds like the whole solution. It is only the useful middle.

The retrieved guide might apply to another machine model. It might have been replaced by a newer procedure. The technician may not be authorized to view the engineering note attached to it. Or the search may return a passage that sounds relevant but describes a different failure.

A vector database can help a product find promising candidates. The product still has to decide which content is eligible, current, authoritative, and useful.

That distinction is the key to understanding vector databases without either dismissing them as “just numbers” or treating them as a machine that understands truth.

The short answer#

A vector database stores and searches embeddings: lists of numbers produced by a machine-learning model. The numbers locate an item—such as a sentence, image, product, support ticket, or song—inside a mathematical space. Items the model considers similar tend to be closer together.

When a user submits a query, the application converts that query into an embedding using a compatible model. The database then finds nearby stored embeddings and returns the associated records—or IDs used to fetch them—plus stored metadata.

This makes vector search useful when the best result may express the same idea with different words, or when similarity involves content that keyword search cannot describe neatly, such as images or audio.

The important restraint is simple:

A similarity score is not a truth score.

The database can say, “These items are close under this model and metric.” It cannot say, on its own, “This policy is current,” “This user may see it,” “This answer is correct,” or “This action is safe.”

An embedding is a model-made map#

Imagine giving every item in a collection a set of coordinates. On an ordinary map, two numbers might describe latitude and longitude. An embedding may use hundreds or thousands of numbers to represent patterns the model learned from data.

Those dimensions are not usually clean human concepts such as “technical,” “urgent,” or “about packaging.” Google’s embedding guide warns that real embedding dimensions are often difficult for people to interpret. The useful property is relational: items that the model represents similarly tend to end up closer together.

This is why a two-dimensional cluster diagram can teach the idea but should not be mistaken for the real system. It is a projection of a much higher-dimensional space.

The same content can also look different to different embedding models. A model trained for multilingual document retrieval may arrange the collection differently from one trained for product recommendations or code search. The map reflects the model’s training and task, not a universal geometry of meaning.

Similarity also needs a measuring rule. Common choices include cosine similarity, dot product, and Euclidean distance. They do not behave identically unless the vectors are normalized in particular ways. Follow the embedding model’s documented recommendation, then verify it on your own data rather than choosing a metric because its name sounds familiar. Google’s similarity guide explains the differences.

What the database actually stores#

A production record needs more than a vector. For a document-search product, a useful record might include:

  • Chunk text. The passage the product will display, cite, or send to a model
  • Embedding. The numerical representation used for similarity search
  • Document and chunk IDs. Stable identity for updates, deletion, and citations
  • Source title and URL. A route back to the authoritative material
  • Version and effective date. Protection against retrieving obsolete guidance
  • Tenant and access group. A security boundary for who may retrieve the content
  • Content type and language. Filters and model-selection context
  • Embedding model and version. Evidence needed to reindex consistently
  • Created and updated timestamps. Freshness, operations, and auditability

The vector is a search representation of your content. A vector index organizes those representations for retrieval; neither replaces the content itself.

If the original text, source identity, permissions, and version disappear, the product may still retrieve something that looks relevant while losing the evidence required to trust or maintain it.

How a vector-search product works#

There are two separate lanes: preparing the knowledge and answering a question.

A two-lane diagram shows source documents becoming meaningful chunks, embeddings, and vector records; a user question then passes through permission filters, keyword and vector retrieval, reranking, and a cited answer or refusal.
Indexing prepares content for retrieval. Question-time controls determine which evidence is eligible and how the product uses it.

Lane 1: prepare the knowledge#

  1. Collect the source material. Decide what belongs in the product and who owns it. Remove duplicates, expired versions, and content you do not have the right to process.
  2. Split it into retrievable units. A maintenance procedure, policy clause, product description, or support exchange may each need a different boundary. Preserve headings and surrounding context.
  3. Attach metadata. Keep source, version, language, tenant, access group, effective date, document type, and stable IDs with every chunk.
  4. Create embeddings. Send each chunk through one embedding model and record the exact model/version used.
  5. Store and index. Save the text, vector, and metadata in a system capable of nearest-neighbour search.

Lane 2: answer a question#

  1. Receive the query. Keep the original wording; it may still be valuable for keyword retrieval and auditing.
  2. Apply identity and access rules. A user should not become entitled to a document merely because its vector is similar.
  3. Create the query embedding. Use a model compatible with the stored vectors.
  4. Retrieve candidates. Run vector search, usually with metadata filters. For many text products, run keyword search as well.
  5. Fuse and rerank. Combine result lists, then use a more precise method to reorder a small candidate set if the quality gain justifies the latency and cost.
  6. Fetch the original evidence. Return the source text and metadata, not only a vector and score.
  7. Let the product decide. It may show search results, recommend similar items, detect a duplicate, pass evidence to a language model, or refuse when the evidence is weak.

In a retrieval-augmented generation system, the selected passages become context for a language model. The originating RAG paper combined a generator’s learned parameters with a dense external index. That architecture can make information easier to update and inspect. It does not make the final answer infallible.

How search stays fast when the collection grows#

The simplest nearest-neighbour search computes the distance between the query and every stored vector, then selects the nearest results. That exact approach can be entirely reasonable for a small collection. It also provides a useful reference when measuring the quality of a faster index.

At larger scales, many systems use approximate nearest-neighbour search. Instead of checking everything, the index explores a structure designed to reach promising neighbourhoods quickly. The trade-off is in the word “approximate”: lower latency may come at the cost of missing a candidate the exact search would have returned.

HNSW—Hierarchical Navigable Small World—is a widely used approximate index. It builds layers of proximity links and searches from broad upper layers into more detailed neighbourhoods. The HNSW research paper describes the graph-based index, while current pgvector documentation exposes the practical recall-versus-speed controls.

One source of confusion is worth removing: HNSW uses a graph internally to navigate vectors, but that does not make it a graph database. The HNSW links mean “these vectors are useful neighbours for search.” A domain graph might mean “this supplier provides this component to this plant.” Those are different relationships serving different questions.

For a builder, the operational rule is more important than the algorithm’s name: compare approximate results with exact results on a representative question set, then tune for the latency and recall your product actually needs.

Why vector-only search is often the wrong goal#

Embeddings are good at recovering semantic neighbours. They can be weak where exact wording carries the meaning.

Consider an error code, legal clause number, product SKU, employee ID, or quoted phrase. “QX-204” should not be softened into a vaguely related concept. It should match QX-204.

Keyword systems also do more than literal substring matching. PostgreSQL’s full-text search, for example, parses documents and queries, normalizes terms, and ranks matches using lexical, proximity, and structural information. In the BEIR retrieval benchmark, BM25 remained a strong baseline across diverse tasks, while reranking and late-interaction models achieved the best average zero-shot performance at higher computational cost.

That is why many useful text-search products use hybrid retrieval:

  • keyword search protects exact terms, identifiers, names, and phrases;
  • vector search retrieves semantically similar content;
  • metadata filters restrict the eligible collection;
  • rank fusion combines result lists without pretending their raw scores are directly comparable;
  • reranking spends more computation on a small shortlist.

Current Elastic documentation describes reciprocal rank fusion as one way to combine full-text and vector rankings. pgvector can pair vector search with PostgreSQL full-text search. The product lesson is vendor-neutral: test the signals together before declaring that one should replace the others.

Vector, relational, keyword, or graph?#

Ask what the product must find.

Four cards compare relational databases for exact facts and transactions, keyword search for exact words and identifiers, vector search for similar meaning or content, and graph databases for known relationships and paths.
Choose the capability by the question. Many useful products combine exact, lexical, semantic, and relationship retrieval.
  • What exact fact or transaction is current? Start with relational database. Example: “What is the status of order 10472?”
  • Which item contains these words or this identifier? Start with keyword/full-text search. Example: “Find procedure QX-204.”
  • Which items are similar in meaning or content? Start with vector search. Example: “Find issues like this carton jam.”
  • How are known entities connected? Start with graph database. Example: “Which plants depend on this supplier?”

A graph database stores entities as nodes and explicit relationships between them, then supports relationship and path traversal. Neo4j’s graph overview gives the property-graph model in those terms. Vector search answers a different question: which items are close according to an embedding model?

The categories increasingly overlap. PostgreSQL can add vector search through pgvector. Search engines can combine lexical and vector retrieval. Current Neo4j releases include vector indexes alongside graph traversal.

So the architecture question is no longer “Which branded database category wins?” It is “Which exact, lexical, semantic, and relationship capabilities does this product need, and where can the team operate them reliably?”

Build the retrieval product before the chatbot#

The fastest route to a convincing demo is to embed a folder of documents, retrieve a few passages, and ask a language model to answer. The fastest route to learning whether the product works is different: make retrieval measurable before generation can hide its mistakes behind fluent prose.

Here is a practical build sequence.

1. Write the product contract#

Choose one narrow job.

Good: “Help packaging technicians find the current approved troubleshooting section for a named machine model.”

Too broad: “Answer anything about operations.”

Record:

  • who the user is;
  • what collection may be searched;
  • what a successful result looks like;
  • which questions the product must refuse;
  • what data must never cross a tenant or access boundary;
  • whether the output is a search result, recommendation, draft answer, or action.

This contract determines the data, filters, evaluation, and risk level.

2. Build a small, authoritative corpus#

Start with enough content to represent the real difficulty without creating an indexing project before you have a product.

For each document, capture the owner, version, effective date, language, access group, stable ID, and canonical URL. Keep revoked or superseded material out of the eligible index unless the product has an explicit historical-search mode.

3. Create a labelled question set#

Collect 25 to 50 real or carefully written questions. For each one, record:

  • the source passage that should be retrieved;
  • acceptable alternatives;
  • exact identifiers that must match;
  • filters that must apply;
  • questions with no supported answer;
  • adversarial cases that try to cross access boundaries.

This modest set becomes your first evaluation harness. Without it, “the results look good” is the only quality metric.

4. Establish a keyword baseline#

Run the questions through the simplest credible full-text search. Save the ranked results and latency.

The baseline tells you what embeddings actually improve. It may also reveal that the collection is small and well-labelled enough that vector search is unnecessary.

5. Choose and version an embedding model#

Use a model designed for your data type, language, and retrieval task. Record the model name, version, vector dimension, similarity metric, and any query/document prefixes it requires.

Public benchmarks are useful for narrowing the field, but not for outsourcing the decision. The MTEB paper found that no single embedding method dominated every evaluated task. Run the strongest realistic candidates against your labelled questions and your privacy, latency, deployment, and cost constraints.

Changing models usually changes the vector space. Plan for a versioned reindex rather than mixing incompatible embeddings and hoping the database will interpret them.

6. Chunk around the unit a user needs#

There is no responsible universal chunk size.

A short policy clause may stand alone. A repair instruction may need its warning, prerequisites, and numbered steps together. A product catalogue may work best as one record per item. A support conversation may need the issue and accepted resolution without the entire thread.

Preserve headings and stable source positions. Add overlap only when a boundary would otherwise separate information that must be retrieved together. Then test the result. Chunking is a product decision because it defines what the retriever is able to return.

7. Compare three retrieval variants#

Run the same labelled questions through:

  1. keyword only;
  2. vector only;
  3. hybrid keyword plus vector.

Measure whether the expected source appears in the top results. Inspect failures, especially exact identifiers, negation, short queries, uncommon terminology, and near-duplicate documents with different versions.

If a reranker improves the shortlist enough to justify the extra latency and cost, add it after retrieval—not as a substitute for fixing a weak corpus or missing filter.

8. Add generation only after evidence retrieval works#

If the product needs an answer rather than a result list, give the language model the original question, the selected passages, and the source metadata. Require citations that resolve to the displayed evidence. Define an honest refusal when the eligible evidence is absent, contradictory, stale, or below the product’s quality threshold.

Retrieval improves what the model can see. It does not force the model to interpret the evidence correctly. NIST’s Generative AI Profile recommends regular evaluation and monitoring, source-and-citation verification, and defined human-oversight roles for generative-AI systems, including systems that use RAG.

If the assistant will propose or execute actions, continue to Your AI Agent Found the Right Document. Can It Safely Act?. Retrieval is only one layer of an accountable agent.

The smallest useful product surface#

The technology can stay simple if the responsibilities are explicit. A first working product needs five pieces:

  1. An ingestion job that accepts approved documents, validates metadata, splits content, creates embeddings, and upserts versioned records.
  2. A search endpoint that authenticates the user, applies tenant and access filters, runs lexical and vector retrieval, fuses or reranks candidates, and returns original passages with sources.
  3. An evidence interface that shows why a result appeared, where it came from, and which version the user is reading.
  4. An update and deletion path that reindexes changed content and removes revoked content predictably.
  5. An evaluation job that runs the labelled question set against each candidate configuration and preserves the results.

The search response should be useful before an LLM touches it. At minimum, return the chunk text, document title, stable URL or document ID, version, updated date, retrieval channel, and a rank. Keep raw vector scores as diagnostic information rather than presenting them as confidence percentages.

Add an answer endpoint only after the evidence list works. That endpoint should call the same permission-aware search, pass a small set of cited passages to the model, and return either a source-supported answer or a defined refusal. Do not create a second, less secure retrieval path merely because the chat interface is convenient.

A prototype is ready for real user testing when it beats or complements the keyword baseline on the agreed question set, exact identifiers still work, every displayed source resolves, document changes reach the index, refusal cases behave honestly, and access tests show no cross-boundary retrieval. Your latency and quality thresholds should come from the product contract, not from a generic tutorial.

Measure the system in four layers#

A single thumbs-up score hides too much. Separate the evaluation.

Retrieval quality#

  • Does the expected source appear in the top k results?
  • How does approximate search compare with exact search?
  • Are obsolete or wrong-version documents excluded?
  • Do exact identifiers survive the hybrid pipeline?
  • Which question types fail consistently?

Answer quality#

  • Does every material statement have support in the cited passage?
  • Do citations point to the correct source and location?
  • Does the system acknowledge contradictory evidence?
  • Does it refuse when no eligible source supports an answer?

Operational quality#

  • What are p50 and p95 latency?
  • What does each query cost end to end?
  • How quickly do updates and deletions reach the index?
  • Can a failed reindex be rolled back?
  • Can the team identify which model and source version produced a result?

Security and rights#

  • Are access filters enforced at retrieval time rather than left to the language model?
  • Can one tenant retrieve another tenant’s content?
  • Can untrusted content poison the collection?
  • Can deleted, expired, or unlicensed material still surface?
  • Do logs expose queries or passages that contain sensitive information?

OWASP’s Vector and Embedding Weaknesses guidance highlights unauthorized access, cross-context leakage, inversion, and data poisoning as risks around vector/RAG systems. A nearest-neighbour index is not an authorization system.

Where vector search earns its place#

Vector retrieval is a strong candidate when similarity itself creates product value:

  • semantic search across differently worded documents;
  • duplicate support-ticket or incident detection;
  • related-product, article, or media discovery;
  • image-to-image or text-to-image search;
  • matching a user description to candidate content;
  • retrieving evidence for a RAG assistant;
  • finding anomalous items when “different from the normal cluster” is meaningful and properly evaluated.

Each use case still needs its own model, metadata, risk controls, and quality definition. A document-retrieval embedding is not automatically the right representation for recommendations, fraud, or industrial anomalies.

When you probably do not need one#

Do not add vector search merely because the product includes AI.

Start elsewhere when:

  • exact IDs, amounts, dates, or transaction state determine the answer;
  • a small collection already works well with navigable categories and keyword search;
  • the product mainly performs filters, joins, aggregations, or transactions;
  • explicit relationships and multi-hop paths are the central question;
  • you have no labelled questions with which to measure improvement;
  • the content lacks clear ownership, versioning, access rules, or usage rights;
  • failure would be high-impact and the system has no citation, refusal, review, or rollback path.

Sometimes the right first implementation is full-text search in the database you already operate. Sometimes it is a vector column beside relational fields. Sometimes the scale and workload justify a dedicated vector service. The correct choice follows the query, corpus, security boundary, latency target, operating skill, and evidence—not the fashion of the database label.

The practical conclusion#

A vector database does one valuable job: it turns a large similarity problem into a manageable shortlist.

The embedding model decides what “near” means. The index decides how quickly candidates can be found. Metadata and permissions decide which candidates are eligible. Keyword retrieval protects exact language. Reranking improves order. The source record provides evidence. The product decides whether to display, generate, recommend, or refuse. People still own the corpus, controls, evaluation, and consequences.

Build that chain in the right order. Start with a narrow question set and a keyword baseline. Add embeddings only where they recover useful candidates the baseline misses. Test hybrid retrieval. Make security and versioning part of the record. Add generation last.

That approach produces something more durable than a clever demo: a search system whose usefulness you can explain, measure, and improve.

For the wider engineering principle, read AI Can Write the Code. You Still Own the System..

Sources#

Reader briefing

Keep the useful part of the internet close

The Adithhya Brief will turn worthwhile ideas into a concise note with a practical next step.

Share what would help

This opens a feedback email; it does not subscribe you. No recurring marketing is sent today. Do not include sensitive personal information.

Found an error or have better evidence? Send a correction. Material updates are reviewed and reflected transparently.

Continue reading

Related signals