When to add a vector index

Follow a search from text to candidates, then choose exact or approximate retrieval, filters, and an evaluation baseline.

Written deep dive25% previewBy Daniyal Saqib

Read the opening here. A free account gives you the full guide.

Vector retrieval indexes are specialized database structures used to find records based on semantic or mathematical similarity rather than exact values. They are widely used in AI applications such as semantic search, recommendation systems, image retrieval, and Retrieval-Augmented Generation (RAG).

An employee searches for the troubleshooting guide for error ERR-84721. The retrieval service encodes the query in the same embedding space as the document vectors and uses the employee’s trusted identity to scope the search. In this example, documents A, B, and C are eligible. Document D belongs to another tenant and is outside the search scope. The vector index scores candidates by similarity. Before any candidate text is used or returned, the service verifies that the document is current and the employee can still read it.

Exact search scores every eligible vector and gives a reference result for the chosen metric. Approximate nearest-neighbor (ANN) search uses an index to explore promising candidates, saving work at the risk of missing some exact neighbors. HNSW is one ANN index that uses links between vectors to guide that search.

Suppose exact search and the approximate index both put A and B in their top two. Both candidates pass verification, so both can be returned. Yet the only guide with the required troubleshooting steps is C, as determined by a human relevance label. The approximate search agrees with exact search on both neighbors, while neither result list contains the evidence needed to answer the question. Looking at both measures helps distinguish an index miss from a problem with how the search ranks relevant evidence.

Our example is an internal search service for troubleshooting guides.

3 more sections to read

Sign in to keep reading

When to add a vector index

Continue this section and read the complete guide and explore its visuals.

Free account. No payment required.

Read how we handle account information in our privacy notice.

3 more sections to read

There’s more in the full article

Continue reading with a free account.

Keep reading

Free account. No payment required.

Inside the full article

Continue the guide with 3 more sections.

  1. Avoiding full vector scansRead after sign-in
  2. Controlling ANN search qualityRead after sign-in
  3. Reducing vector index memoryRead after sign-in
Continue reading

3 more sections to read

Sign in to keep reading

When to add a vector index

Continue this section and read the complete guide and explore its visuals.

Free account. No payment required.

Read how we handle account information in our privacy notice.