Why Your RAG Bot Misses Indexed Chunks: The HNSW ef_search Blind Spot
Vector search using HNSW (Hierarchical Navigable Small World) indexes does not guarantee returning all relevant results, because it performs a greedy graph walk that can silently skip valid documents. A key parameter called ef_search — defaulting to just 40 in pgvector — controls how many candidates the walk keeps in memory, and setting it too low causes recall to drop sharply, especially when metadata filters are applied post-search. A developer discovered this after a support bot repeatedly failed to surface a document that was confirmed present in the database, with BM25 keyword search finding it at rank 2 while vector search omitted it entirely. Engineers can measure the gap by comparing vector search results against an exact brute-force scan, then tuning ef_search upward until recall stabilizes. For smaller corpora of a few hundred thousand vectors or fewer, brute-force search may be fast enough to bypass the approximation problem altogether.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in