Knowledge Bases for Bedrock
Knowledge Bases for Bedrock is a managed RAG pipeline. You point it at documents in S3, it chunks and embeds them automatically, stores vectors in a supported vector database, and exposes aRetrieveAndGenerate API that handles retrieval and augmented generation in one call. No chunking code, no embedding loops, no vector store management required.
What Gets Managed for You
Managed by Bedrock
- • Document ingestion from S3 (PDF, DOCX, HTML, CSV, TXT, MD)
- • Chunking — fixed size or semantic (configurable)
- • Embedding — your choice of embedding model
- • Vector store writes and index management
- • Incremental sync (re-ingest on S3 changes)
You configure
- • S3 data source bucket(s)
- • Embedding model (Titan Embed v2, Cohere Embed v3)
- • Vector store backend
- • Chunk size and overlap
- • Retrieval model + system prompt
Supported Vector Stores
Bedrock Knowledge Bases integrates with seven vector stores as of early 2026. You either let Bedrock create a managed OpenSearch Serverless collection, or connect an existing vector database:
Hybrid Search
Hybrid search (GA April 2025 for OpenSearch) combines dense vector search (semantic similarity) with sparse BM25 keyword search. Bedrock merges results using Reciprocal Rank Fusion (RRF) before passing chunks to the generation model. This significantly improves retrieval accuracy for queries with specific terms (product codes, names, technical jargon) that pure semantic search struggles with.
Using the API
The RetrieveAndGenerate call retrieves relevant chunks, injects them into the model context, and returns a generated answer with source citations in one step:
import boto3
agent_runtime = boto3.client("bedrock-agent-runtime", region_name="us-east-1")
response = agent_runtime.retrieve_and_generate(
input={"text": "What is our refund policy for digital products?"},
retrieveAndGenerateConfiguration={
"type": "KNOWLEDGE_BASE",
"knowledgeBaseConfiguration": {
"knowledgeBaseId": "KB_ID",
"modelArn": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-5",
},
},
)
print(response["output"]["text"])
# Citations available in response["citations"]For retrieval-only (to build your own generation step), use the Retrieve API, which returns ranked chunks with scores and source metadata.
Metadata Filtering
You can attach metadata to documents (e.g. department, document type, date) and filter retrieval by metadata at query time. This prevents cross-contamination when one knowledge base holds documents from multiple sources and you want each user to only retrieve from their authorised subset.
Checklist: Do You Understand This?
- What does Bedrock Knowledge Bases manage for you versus what you configure yourself?
- What is hybrid search and why does it improve retrieval over pure vector search?
- What is the difference between
RetrieveAndGenerateandRetrieve? - When would you use metadata filtering?