Course contentsShow
← AI Engineering
Lesson 281 of 1,8867. Vector Databases - FundamentalsFree lesson

Indexing Strategies for Hybrid Search

How vector databases index both embeddings and metadata for efficient hybrid queries.

Indexing Strategies for Hybrid Search

What you'll learn: How vector databases efficiently index both embeddings and metadata to enable fast hybrid queries that combine semantic similarity with keyword and filter conditions.

The Dual-Index Challenge

In hybrid search, you're not just searching vectors—you're combining vector similarity with keyword matching and metadata filtering. This requires two different types of indexes working together: one for semantic search (vector indexes like HNSW or IVF) and one for structured data (traditional inverted indexes or B-trees for metadata).

Think of it like a library that organizes books by both topic similarity (vector space) and by concrete attributes like author, year, and genre (metadata fields). You need both systems indexed efficiently to answer "find books semantically similar to this description and published after 2020 and by this author."

How Vector Databases Handle This

Vector databases maintain parallel indexes:

  1. Vector index (HNSW, IVF, etc.) for approximate nearest neighbor search
  2. Metadata index (B-tree, hash index) for exact filtering on fields like category, timestamp, or author

The key decision is when to apply each filter. With pre-filtering, you filter metadata first, then search the reduced vector space. With post-filtering, you retrieve top-K candidates from the vector index, then filter them by metadata (as covered in lesson 277).

Optimization Strategies

Smart vector databases create filtered subgraphs in the vector index—essentially pre-computing separate navigation structures for common metadata values. For example, maintaining separate HNSW graphs per category allows lightning-fast searches within that category without scanning irrelevant vectors.

Key Takeaway: Hybrid search requires parallel indexing of both vector embeddings and metadata, with strategic decisions about filter application order and potentially specialized sub-indexes to maintain performance across both dimensions.