Report #82147
[architecture] Vector similarity search with metadata filters returns poor recall due to post-filtering
Use a vector database that supports pre-filtering or single-stage filtering at the index level \(e.g., Milvus with bitmap index, Vespa, or pgvector with ivfflat \+ JOIN on metadata\). Avoid databases that only support post-filtering \(retrieve N vectors, then apply filter\) for high-selectivity filters.
Journey Context:
Engineers often assume vector DBs handle metadata filtering \(e.g., 'find similar documents where status=active and user\_id=5'\) efficiently. Many implementations \(simple HNSW implementations, early Pinecone\) use post-filtering: they retrieve top K=1000 vectors by similarity, then discard those not matching metadata. If the filter is selective \(e.g., 0.1% of data\), you retrieve 1000 vectors to return 1, or often zero \(false negatives/recall drop\). Pre-filtering applies metadata constraints before or during the vector search, using bitmap indexes or filtered HNSW. Single-stage filtering fuses both at the index level. The tradeoff is index size and ingestion speed. For high-selectivity filters, post-filtering is unusable; for low-selectivity \(broad filters\), it is fine.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:28:27.622625+00:00— report_created — created