Users of an HR assistant should only get answers from documents for their own country and from the current year. How do you make retrieval respect that?
- Exam domain
- Foundation Model Integration, Data Management, and Compliance31% of the exam
- Difficulty
- Medium
- In this mock
- 28 questions on this domainPractise this domain
Why the exam asks this
Task 1.4: Design and implement vector store solutions.
Objective in the exam guide: Skill 1.4.2: Develop comprehensive metadata frameworks to improve search precision and context awareness (for example, by using S3 object metadata for document timestamps, custom attributes, tagging systems for domain classification).
Semantic similarity cannot tell a 2022 policy from a 2026 one, or France from Germany. Metadata filters are how professional RAG systems keep retrieval precise and appropriate.
Why A is the answer
Attach metadata such as country and year to each document, and filter retrieval on it
Metadata filters restrict retrieval to matching documents before anything reaches the model.
Remember: Filter by metadata so only the right documents can be retrieved.
How it works
Each document can carry metadata, such as country, department, author or effective date.
At query time, a metadata filter limits retrieval to documents whose metadata matches, before similarity ranking.
Bedrock Knowledge Bases supports these filters, so wrong documents never reach the model.
Clues in the question
The words that point to the answer, and what each one tells you.
- Their own country, current year
- Attributes of documents, not of meaning.
In detail
- Bedrock Knowledge Bases supports metadata filtering on retrieval.
- Metadata can come from S3 object metadata or a metadata file alongside each document.
Side by side with look-alikes
| Approach | Wrong documents retrieved? |
|---|---|
| Metadata filter | No |
| Prompt instruction | Yes |
| Larger chunks | Yes |
| More results | Yes, even more |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Attach metadata such as country and year to each document, and filter retrieval on itRight
Filter by metadata so only the right documents can be retrieved.
B. Ask the model to ignore other countries in its answerWrongMost tempting
The wrong documents would still be retrieved and could leak into the answer.
Why it tempts: It sounds simple and needs no data work. But the wrong documents are still retrieved, and the model may blend them in.
C. Create a larger chunk sizeWrong
Chunk size does not know which country a document is for.
D. Raise the number of retrieved resultsWrong
More results bring in more wrong documents, not fewer.
In practice
- Decide the metadata schema before ingestion, and populate it for every document.
- Fill filter values from the signed-in user's profile, not from what they type.
Use case
An illustrative scenario, not a real incident.
An HR team tags each policy with country and effective year, and the assistant retrieves only the user's country and the current year.
See how it works
flowchart LR Q["Question from a user in France"] --> F["Filter: country = FR, year = 2026"] F --> S["Semantic ranking on matching documents"] S --> M["Model"]
How to read this chart
- Read it in order: Question from a user in France, then Filter: country = FR, year = 2026, then Semantic ranking on matching documents, then Model.