ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Question]: Metadata filtering via metadata_condition does not work when using RAGFlow as external knowledge base in Dify

Open 1099446868 opened this issue 6 months ago • 2 comments

Self Checks

  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (Language Policy).
  • [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • [x] Please do not modify this template :) and fill in all the required fields.

Describe your problem

I’m integrating RAGFlow (v0.19.0) as an external knowledge base into Dify (v1.4.2) following the official documentation:

🔗 External Knowledge API Documentation - Dify

I have configured a metadata field called brand_name in RAGFlow documents and am trying to filter results using the metadata_condition parameter during retrieval.

Request Payload

{ "knowledge_id": "xxxxxxx", "query": "xxxxxxxxx", "retrieval_setting": { "top_k": 30, "score_threshold": 0.2 }, "metadata_condition": { "logical_operator": "and", "conditions": [ { "name": ["brand_name"], "comparison_operator": "is", "value": "Pampers" } ] } }

Expected Behavior The API should return only documents where the brand_name metadata equals "Pampers".

Actual Behavior The API ignores the metadata_condition parameter entirely and returns all matching documents regardless of the brand_name value.

Question Does RAGFlow currently support metadata-based filtering that is compatible with Dify’s metadata_condition structure? If not, are there any plans to implement metadata filtering capabilities in RAGFlow’s native API?

1099446868 avatar Jun 16 '25 09:06 1099446868

RAGFlow does not currently support metadata-based filtering compatible with Dify’s metadata_condition structure. The retrieval API in RAGFlow ignores the metadata_condition parameter and does not filter documents based on metadata fields—metadata is only attached to results for informational purposes, not for filtering. There’s no evidence in the codebase or issues that this feature is planned or in progress in the native API. Recent updates have focused on other filtering capabilities, but not on dynamic/request-driven metadata filtering as required by Dify’s integration expectations (sourcediscussionrelated).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

dosubot[bot] avatar Jun 16 '25 09:06 dosubot[bot]

Does RAGFlow currently support metadata-based filtering that is compatible with Dify’s metadata_condition structure? No. I don't think so. And it's our plan to filter with meta data.

KevinHuSh avatar Jun 18 '25 03:06 KevinHuSh

Does RAGFlow currently support metadata-based filtering that is compatible with Dify’s metadata_condition structure? No. I don't think so. And it's our plan to filter with meta data.

Oh,!I'm glad to hear this exciting news. It's an anticipated achievement

1099446868 avatar Jun 20 '25 02:06 1099446868

@KevinHuSh Will version v0.20.0 fix this issue ? also when will version v0.20.0 be released ?

OneKe avatar Jul 28 '25 08:07 OneKe

I'm afraid not. In couple of days.

KevinHuSh avatar Jul 31 '25 07:07 KevinHuSh