﻿# Dify automatic metadata filtering can fall back to an unfiltered search

Use manual Dify metadata filters when a regional or product corpus boundary must hold, and understand why automatic inference can search without a filter.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-dify-manual-metadata-filter/
Language: en

## State the document boundary as data

A shared policy base holds regional procedures. An assistant for one region should not answer from another region merely because the wording is similar. Dify's [Agent Knowledge Retrieval node](https://docs.dify.ai/en/cloud/use-dify/nodes/knowledge-retrieval-v2) supports document metadata for this boundary. Label the documents with an explicit region or product field instead of relying only on a prompt that asks the final model to ignore irrelevant policies.

## Choose field types before applying labels

The current node guide says a metadata field's type cannot be changed later. Use a numeric type for numeric comparisons and a time type for before-or-after conditions; labels that look numeric but are stored as strings have a different contract. Source synchronization preserves document labels when updating content. Record the labeling convention so a new source does not silently enter the collection without the attribute its consuming application expects.

## Distinguish Manual from Automatic filtering

Manual filtering sets the condition directly. Automatic filtering asks a model to infer conditions from the question and runs unfiltered when it cannot determine one. That fallback can be reasonable for exploratory search but fails a requirement that every request stay inside a fixed regional subset. Use Manual for that requirement and test a question that omits the region name; ordinary users should not need to repeat an internal routing label in every message.

## Keep multi-base and migration rules explicit

When several bases are selected, filter fields must exist in all of them with compatible names and types. The [upgrade guide](https://docs.dify.ai/en/cloud/use-dify/knowledge-base/upgrade-from-classic) carries metadata into the new base but still requires configuring filters on the replacement retrieval node. A successful upgrade therefore does not prove that the application retained its source-selection boundary. Include those conditions in the consumer cutover review, alongside the new base identifier.

## Do not confuse relevance filters with access grants

The [creation guide](https://docs.dify.ai/en/cloud/use-dify/knowledge-base/create-knowledge-base) separately controls who may view a knowledge base and connect it to applications. A regional filter narrows documents inside an otherwise authorized base; it is not a substitute for resource permissions. The [task-contract guide](/journal/learn-codex-task-contract/) can state the intended subset, while [citation-support checks](/journal/rag-citation-precision-completeness/) verify the actual returned evidence. Test labels, configured conditions, and resulting passages together rather than trusting an appropriate-sounding assistant name.
