# Vertex AI RAG Engine: Metadata Filtering not working

**URL:** <https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263>\
**Category:** Agents\
**Tags:** rag, gemini, vector-search\
**Created:** [February 3, 2026, 10:15am UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263 "2026-02-03T10:15:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeslin\_Joseph](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/jeslin_joseph/32/237583_2.png) [@Jeslin\_Joseph](https://discuss.google.dev/u/Jeslin_Joseph)\
**Post date:** [February 3, 2026, 10:15am UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/1 "2026-02-03T10:15:05Z")

</div>

I’m struggling to get **metadata filtering** working correctly using the Vertex AI RAG engine (`google-cloud-aiplatform`). My goal is to restrict retrieval results based on a `category` field assigned to different files within a single RAG corpus.

**My Setup:**

1. **Storage:** Files are stored in a GCS bucket folder.

2. **Metadata File:** I have a `metadata.jsonl` in the same folder.

3. **Import:** I imported the entire folder into the RAG Corpus using the `import_files` API.

**The Problem:**

Despite the filter, the retrieval returns results from **all** categories (ignoring the filter).

Is there a specific schema requirement for the `metadata.jsonl? `Any guidance on this would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![shuhaib\_arkn](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/shuhaib_arkn/32/67707_2.png) [@shuhaib\_arkn](https://discuss.google.dev/u/shuhaib_arkn)\
**Post date:** [February 5, 2026, 12:20pm UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/2 "2026-02-05T12:20:34Z")

</div>

May be the JSON Structure is Not suitable try with simple JSON,  
{“file\_path”: “gs://my-bucket/hr/policy1.pdf”, “category”: “HR”}

---

<div class="post-metadata">

**Author:** ![lk213](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/lk213/32/187130_2.png) [@lk213](https://discuss.google.dev/u/lk213)\
**Post date:** [February 22, 2026, 3:13am UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/4 "2026-02-22T03:13:33Z")

</div>

> [@Vertex AI Rag engine file metadata and metadata filtering](https://discuss.google.dev/t/vertex-ai-rag-engine-file-metadata-and-metadata-filtering/324534):
>
> I’m trying to import files into rag engine from gcs. I can see I can see in the [docs for rag engine import](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1beta1/projects.locations.ragCorpora.ragFiles/import) that I can set rag\_file\_metadata\_config. I want to use inline\_metadata\_schema\_source and inline\_metadata\_source, but I can’t find any examples or docs for what they should look like. Similarly, I can’t find any docs on what metadata.json should look like if I wanted to use a metadata file in gcs instead, though I’d prefer just using the inline options. And for context retrieval filtering, …

I’m also trying to work this out. I tried using the same metadata.json and filter format that worked for vertex ai search, but no luck. The docs I linked in my post seem to indicate it is possible, so I made a support ticket for it with google. They told me the functionality exists in the beta api and works, but isn’t technically released yet, so they refused to tell me how to use it.

What syntax did you try for the filter?

---

<div class="post-metadata">

**Author:** ![Edson\_Cepeda](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/edson_cepeda/32/186951_2.png) [@Edson\_Cepeda](https://discuss.google.dev/u/Edson_Cepeda)\
**Post date:** [March 9, 2026, 11:15pm UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/6 "2026-03-09T23:15:00Z")

</div>

@Jeslin_Joseph hey I was wondering if you could get metadata filtering on rag engine working, and if so how did you do it?

---

<div class="post-metadata">

**Author:** ![Austin\_Wood](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/austin_wood/32/185400_2.png) [@Austin\_Wood](https://discuss.google.dev/u/Austin_Wood)\
**Post date:** [March 10, 2026, 9:05pm UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/7 "2026-03-10T21:05:57Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![Austin\_Wood](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/austin_wood/32/185400_2.png) [@Austin\_Wood](https://discuss.google.dev/u/Austin_Wood)\
**Post date:** [March 11, 2026, 10:05pm UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/8 "2026-03-11T22:05:32Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![Amira](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/amira/32/186225_2.png) [@Amira](https://discuss.google.dev/u/Amira)\
**Post date:** [May 21, 2026, 1:19pm UTC](https://discuss.google.dev/t/vertex-ai-rag-engine-metadata-filtering-not-working/327263/9 "2026-05-21T13:19:37Z")

</div>

Hey, did you find a solution on how to attach metadata to the vertex ai rag engine?
