dify - 💡(How to fix) Fix [Feature]: Support array[string] and array[number] for "in" / "not in" metadata filtering in Knowledge Base [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35314Fetched 2026-04-17 08:56:12
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
2
Author
Participants
Assignees
Timeline (top)
assigned ×2labeled ×2commented ×1mentioned ×1

Root Cause

I was trying to retrieve specific chunks by filtering metadata against multiple possible values (for example, fetching documents that belong to a list of specific category IDs or tags). It is frustrating because without the in or not in operators for arrays, I either have to make multiple separate queries for each value or retrieve more documents than needed and filter them on the client side, which is inefficient.

RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Currently, when trying to filter knowledge base documents using metadata, Dify does not seem to support passing an array of strings (array[string]) or an array of numbers (array[number]) to perform "contains" (in) or "does not contain" (not in) filtering on string or number metadata fields.

I was trying to retrieve specific chunks by filtering metadata against multiple possible values (for example, fetching documents that belong to a list of specific category IDs or tags). It is frustrating because without the in or not in operators for arrays, I either have to make multiple separate queries for each value or retrieve more documents than needed and filter them on the client side, which is inefficient.

2. Additional context or comments

Expected behavior: The knowledge base metadata filter should accept an array of values and support in and not in operators for string and number type metadata.

For example, the API/UI should support filters like:

  • {"category_id": {"in": [1, 2, 3]}} (Array of numbers)
  • {"tags": {"not_in": ["tagA", "tagB"]}} (Array of strings)

Most underlying vector databases (such as Qdrant, Milvus, Pinecone, Weaviate) already natively support array-based in/not in filtering. Exposing this capability through Dify's Retrieval API and workflow UI would greatly enhance the precision and flexibility of RAG applications.

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

extent analysis

TL;DR

Enhance Dify's Retrieval API and workflow UI to support array-based in and not in filtering for string and number metadata fields.

Guidance

  • Review the documentation of the underlying vector databases (Qdrant, Milvus, Pinecone, Weaviate) to confirm their support for array-based in/not in filtering.
  • Investigate the current implementation of Dify's metadata filtering to identify the specific limitations or missing functionality that prevent array-based filtering.
  • Consider contributing to the feature by modifying the Retrieval API and workflow UI to accept and process arrays of values for in and not in operators.
  • Evaluate the potential performance implications of implementing array-based filtering, including the impact on query efficiency and result set sizes.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The feasibility of this feature enhancement depends on the specific requirements and constraints of Dify's architecture and the underlying vector databases. Additional research and discussion may be necessary to determine the best approach for implementing array-based filtering.

Recommendation

Apply workaround: Contribute to the feature by modifying the Retrieval API and workflow UI to support array-based in and not in filtering, as this would greatly enhance the precision and flexibility of RAG applications.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING