Wednesday, September 16, 2026

 There is a growing body of work, both academic and commercial, that treats “narrowing the scope” of vector search via metadata as a first class design concern rather than an afterthought. This is sometimes referred to as, filtered approximate nearest neighbor search (FANNS), where a similarity query is combined with predicates over structured attributes, and the system attempts to avoid scanning the entire vector index while still returning neighbors consistent with the filter. One study analyzes how such filtered search behaves in FAISS, Milvus, and pgvector, and introduces a taxonomy of filtering strategies and a Global Local Selectivity (GLS) metric to capture how strongly the filter correlates with the query vector distribution. 

In practice, systems tend to expose a small set of recurring constructs that allow dynamic narrowing without re indexing the entire corpus. One construct is partitioned or clustered indexes, where the vector space is divided into coarse regions—IVF lists in FAISS, partitions in Milvus, shards or routing keys in Elasticsearch/OpenSearch, or namespaces/indexes/collections in commercial vector services. At ingestion time, each vector is assigned to one or more partitions based on metadata or a coarse quantizer. At query time, the engine uses the filter to select a subset of partitions and then runs ANN search only within those partitions. Because the partition boundaries are stable, the system does not need to rebuild the global index when the filter changes; it only chooses which partitions to probe. The FANNS study reports that partition based indexes such as IVFFlat can outperform graph based indexes like HNSW for low selectivity filtered queries, which suggests that this partitioning construct is particularly effective when the filter significantly reduces the candidate set. 

A second construct is hybrid indexing, where metadata is indexed with traditional structures (B trees, inverted indexes, bitmap indexes) and vectors are indexed with ANN structures (graphs, product quantization, IVF). The query planner first uses the metadata index to identify a candidate subset of rows or segments, and then applies vector similarity search only to those candidates. Milvus is described as using a hybrid approximate/exact execution strategy for filtered vector search, combining relational filtering with ANN search to stabilize recall under varying filter selectivity. In relational environments such as pgvector on PostgreSQL, the cost based optimizer can choose between a sequential scan with exact distance computation on a filtered subset, or an ANN index scan over the full table, depending on estimated costs. The same study notes that pgvector’s optimizer sometimes prefers approximate index scans even when exact sequential scans over a filtered subset would yield perfect recall at similar latency, which highlights how important the optimizer is in exploiting narrowed scope efficiently. 

A third construct is segment level pruning and tiered storage. Systems like Milvus, Weaviate, and some commercial services organize data into segments or collections that can be independently indexed and placed on different storage tiers. Metadata such as tenant, time range, or document type is used to route vectors into segments. At query time, filters are pushed down to select segments, and only those segments are loaded and searched. This reduces memory footprint and I/O, especially when segments can be kept cold until relevant filters appear. The underlying ANN index within each segment remains unchanged; the narrowing happens at the segment selection layer. This idea echoes long standing practices in columnar stores and time series databases, where partitioning by time or tenant allows queries to skip large portions of data without re indexing


No comments:

Post a Comment