Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Metadata filters

Metadata filters limit retrieval to documents with matching properties. Use them to select content by attributes such as department, document type, or region.

Before you start

Have indexed documents and permission to edit their metadata. To apply a filter in a workflow, also have an editable workflow with a knowledge-base node connected to the base and a query supplied to that node. Start with First input to output workflow if needed, then use Inspect knowledge base references to locate an existing consuming project.

This guide starts in Knowledge Bases to tag documents, then moves to the consuming workflow to configure its search. A filter in that node applies to that workflow's retrieval; it does not change every other agent or workflow using the base. It is not an access-control rule.

Add consistent metadata

Open a document's Metadata tab and add the property used for filtering.

Document metadata property values

Choose a property you can apply consistently, such as department, and use the exact department value that describes each document. Keep a short list of agreed property names and values so collaborators do not introduce variants.

Apply the same property to the other relevant documents.

Document metadata property values

Keep spelling and value types consistent so a filter can match them reliably.

Review retrieval without a filter

Open the consuming workflow and its knowledge-base node. Confirm it points to the base you just tagged, run a known query with No filter, and inspect the source passages returned.

Retrieval results without metadata filters

This shows the available results before you narrow retrieval with metadata.

Configure a metadata filter

In the knowledge-base node's Search Parameters, choose Strict filter and add the condition.

Metadata filter condition controls

Select the metadata property, comparison operator, and value that define the required scope. For a department filter, choose the department property, the equality comparison, and an exact value already stored on the intended documents. Use the same value type as the metadata.

Optionally, open JSON Editor to inspect the equivalent rule if you are comfortable reading it. You can configure the condition with the visual property/operator/value controls without using JSON.

Metadata filter condition controls

Check the property name and value rather than assuming that the visible rule order determines its meaning.

Use and change the filter

Run the query with the filter applied and inspect the returned filenames.

Filtered retrieval condition and results

Confirm that the passages come from documents matching the metadata condition.

Change the condition value when you need a different document group.

Filtered retrieval condition and results

Run again and check that retrieval follows the new scope.

Remove a filter

Use Clear All and No filter to remove the metadata restriction.

Metadata filter removal controls

Metadata filters narrow retrieval. They do not replace source-access permissions.

If the filter returns no results

Return to a document you expect to match and inspect Metadata. Compare the property name, value, and value type with the condition. Clear the filter and rerun the same query: if the source is still absent, check indexing and permissions before changing the condition. Restore the intended filter after the comparison.

Important behavior

Metadata filters narrow which documents retrieval considers. They do not replace source permissions.

A property name and value type must match the metadata stored on the documents.

Continue

Last updated

Was this helpful?