{
  "id": 21329403,
  "title": "Node.js Retrieval Architecture: Metadata Pre- vs Post-Filters (Choose Pre-Filtering at 10M)",
  "url": "https://urgent.news/2026/11/23/node-js-retrieval-architecture-metadata-pre-vs-post-filters-choose",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-23T01:28:28.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sawyerflynn1578/nodejs-retrieval-architecture-metadata-pre-vs-post-filters-choose-pre-filtering-at-10m-11el"
  },
  "original_language": "en",
  "account": "Metadata pre-filtering is recommended for a large, multi-tenant customer-support knowledge base once the corpus reaches 10 million chunks. Tenant, entitlement, locale, product, and validity constraints should reduce the candidate set and duplicated index state before semantic ranking begins. Post-filtering is only suitable for small, low-cardinality corpora with frequently changing filters, as it is not a safe default for access control and becomes expensive when the eligible slice is thin. The primary cost of metadata filtering in a customer-support knowledge base depends on the unit model: N chunks multiplied by bytes for vector data, metadata, retained text or pointers, replication factor, and engine overhead. An uncertain overhead factor can be measured on a representative shard. At 10 million chunks, even small per-record fields should be scrutinized. The decision to use pre-filtering or post-filtering depends on the eligible slice size, variability by tenant, and frequency of constraint changes. Pre-filtering is preferred when the eligible slice is small or highly variable by tenant, and when constraints are primarily entitlement, tenancy, and validity. Post-filtering is acceptable when most documents qualify and constraints change more often than embeddings. A hybrid approach, using pre-filtering for stable constraints and post-filtering for volatile preferences, is also viable. Regardless of the chosen approach, it is crucial to record ingestion details in a ledger to ensure auditability and manage updates efficiently when entitlement mappings change.",
  "summary": "TL;DR Choose metadata pre-filtering for a multi-tenant customer-support knowledge base once the corpus approaches 10 million chunks, because tenant, entitlement, locale, product, and validity constraints should reduce both the candidate set and the amount of duplicated index state before semantic ranking begins. Post-filtering is defensible for a small, low-cardinality corpus whose filters change…",
  "key_points": [
    "Pre-filtering recommended for large, multi-tenant knowledge base at 10M chunks",
    "Tenant, entitlement, locale, product, and validity constraints reduce candidate set",
    "Post-filtering suitable for small corpora with frequently changing filters"
  ],
  "editors_take": "Shifting to metadata pre-filtering at scale protects access control and manages costs by reducing the candidate set before semantic ranking, making it essential for large, multi-tenant knowledge bases.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}