AIF-C01 Practice Question 87: Knowledge Base Metadata Filtering
AWS Certified AI Practitioner (AIF-C01) · Test 9 · question 7 of 10
A company has an Amazon Bedrock knowledge base built from thousands of policy documents in Amazon S3. Each document has an accompanying metadata file with the attributes department and effective_year. An HR chatbot must answer only from HR documents effective in 2024 or later, even when documents from other departments or older years are semantically closer to the question. The team does not want to re-ingest or re-embed the documents. What should they do?
Show answer and explanation
Answer:
Knowledge bases support metadata filtering at query time: *"You can apply filters to document fields/attributes to help you further improve the relevancy of responses."* Filters such as equals on department and greaterThanOrEquals on effective_year can be combined with the andAll logical operator in the retrievalConfiguration of a Retrieve or RetrieveAndGenerate request. Only matching documents are candidates, so no re-embedding is needed (option C). For an S3 data source, each document needs its .metadata.json file, which this company already has.
- A is wrong because returning more chunks widens the result set and makes it more likely that documents from other departments and years appear. - B is wrong because a reranker only reorders retrieved results by relevance. It does not exclude documents, so non-HR or older content can still reach the model. - D is wrong because the model would already have received the other departments' documents as context. An instruction is not a retrieval control and cannot be relied on to keep out-of-scope content from influencing or appearing in the answer.
Reference: Configure and customize queries and response generation