﻿# Filtered AI retrieval: query placement can underfill an authorized shortlist

A post-filter can discard most vector candidates despite enough allowed documents. Inspect actual knn query placement before changing retrieval or access policy.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/enterprise-ai-knn-filter-placement-shortlist-underfill/
Language: en

## Diagnose a short authorized result list

An enterprise assistant requests a shortlist of relevant documents, then removes candidates outside the caller's allowed project. The final context contains little evidence even though the project has many relevant documents. Increasing model context cannot repair candidates that were never selected. First determine whether the search chose neighbors within the eligible population or chose an unrestricted shortlist and discarded most of it afterward.

## Inspect where the filter enters the query

The [Elasticsearch knn query reference](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-knn-query) distinguishes the filter inside the knn clause from filters elsewhere in the query tree. The former has pre-filter semantics; the latter can act as post-filters. Post-filtering may return fewer results than requested even when enough matching documents exist. Preserve the actual serialized query rather than inferring filter placement from a user-interface label or a client method named filtered_search.

## Separate eligibility from approximate ranking

The permission predicate defines which documents may be used. Approximate vector search determines which eligible neighbors are found. A full result count does not establish perfect relevance, while a short list does not automatically establish that no authorized evidence exists. The [OpenFGA RAG guide](https://openfga.dev/docs/modeling/agents/rag-authorization) describes authorization before context admission and the candidate loss possible with post-filtering. Treat its integration guidance as a pattern, not a universal guarantee that fixed oversampling recovers every relevant allowed document.

## Preserve the security boundary while investigating

Keep the same trusted project predicate when comparing query forms. An unrestricted query can help explain candidate competition only in an appropriately authorized test environment; its results must not enter the ordinary caller's model context. Record allowed identifiers and relevance judgments independently of the search engine. Removing the predicate because an answer looks sparse changes the problem rather than solving it. Also inspect any result-size limit after retrieval, because another truncation stage can hide an otherwise adequate candidate set.

## Compare against an eligible reference population

Build harmless fixtures with similar documents inside and outside the allowed project. Establish the relevant allowed identifiers before running approximate search. Compare the pre-filter form and application post-filter form under the same embedding, query and intended output count. Observe candidate count, authorized survivors and recovered relevant identifiers. A proposed acceptance rule requires exclusion of prohibited identifiers and sufficient eligible evidence for the defined fixture. It does not promise exact nearest neighbors from approximate search. No recall measurement or latency comparison was performed here.

## Record query semantics alongside the outcome

[Qdrant filtered-search planning](/journal/qdrant-payload-index-filtered-hnsw/) explains the separate roles of payload and vector indexes. [Weaviate traversal strategies](/journal/weaviate-filter-strategies-acorn-pathseer/) examines how search explores an eligible population. This question instead concerns where the shortlist becomes restricted and why later filtering can underfill it. Preserve the deployed release and effective query form before drawing conclusions from current documentation. A useful incident report distinguishes an empty allowed corpus, insufficient candidate coverage and a malformed permission predicate, with no unsupported claim that one parameter universally fixes retrieval quality.
