Foundation Model Integration, Data Management, and Compliance · Topic 5 of 9

Vector Store Architecture, Metadata and Search at Scale

Design RAG vector stores with Bedrock Knowledge Bases, OpenSearch and Aurora pgvector, add metadata for precise filters and scale with sharding.

  • 6 min
In a nutshell
  • Bedrock Knowledge Bases manage ingestion and retrieval over a vector store you choose.
  • OpenSearch Serverless is the low overhead store; managed OpenSearch clusters give tuning control and the Neural plugin.
  • Aurora pgvector keeps vectors with relational data and supports HNSW and IVFFlat indexes.

What it is

A vector store holds embeddings, numeric vectors that capture meaning, and finds the vectors closest to a query vector. That lets a RAG system retrieve passages that mean the same thing as the question even when they share no keywords.

At the professional level the questions go further: which store fits the workload, how metadata narrows results to the right documents, and how to keep search fast as the index grows to millions of vectors.

DocumentsS3chunk and embedVectorswith metadatastored inVector storeOpenSearch, Aurora, othersk nearest neighborsRelevant chunksfor the prompt

How it works

Choosing and deploying a vector store

OptionStrengthChoose it when
Amazon Bedrock Knowledge BasesManaged ingestion, chunking, embedding and retrievalYou want RAG with the least custom code
Amazon OpenSearch ServerlessVector search collection with no cluster to manageCommon low overhead store for knowledge bases; hybrid search needed
Amazon OpenSearch Service (managed clusters)Full control of shards, instances and pluginsLarge scale tuning, Neural plugin pipelines, existing clusters
Amazon Aurora PostgreSQL with pgvectorVectors next to relational data, queried with SQLTeam already uses PostgreSQL, or joins vectors with business tables
Amazon Neptune AnalyticsGraph plus vectorsRelationships between entities matter (GraphRAG)
Amazon S3 VectorsLow cost vector storage in S3Large, infrequently queried vector sets where cost beats latency

A Bedrock knowledge base connects to a vector store you choose, and can create one for you in some cases. The knowledge base handles ingestion and the Retrieve and RetrieveAndGenerate APIs, so the app does not call the store directly.

Aurora pgvector adds a vector column type and similarity operators to PostgreSQL. It supports HNSW and IVFFlat indexes for approximate nearest neighbor search, so one SQL query can filter on business columns and rank by similarity.

OpenSearch k-NN stores vectors in knn_vector fields and supports engines such as Faiss and Lucene with HNSW graphs. The Neural plugin (neural search) uses ML Commons connectors to call Amazon Bedrock embedding models, so OpenSearch embeds documents at ingest and queries at search time without separate embedding code.

Combining stores in one architecture

Real designs often split responsibilities.

  • Amazon RDS with S3 document repositories: source files live in S3, while RDS holds document records such as owner, version and status, and the vector store holds only the chunks.
  • Amazon DynamoDB for metadata and embeddings: DynamoDB stores fast key lookups for document metadata or cached embeddings, paired with a vector database that performs the similarity search.
  • Topic based segmentation: separate OpenSearch indexes or Bedrock knowledge bases per domain, such as HR, legal and engineering, so each query searches only the relevant segment.
  • Hierarchical organization: search a small index of document summaries first, then search the chunks inside the best documents. Bedrock Knowledge Bases also offers hierarchical chunking, covered on the chunking page.
Queryclassify topicRouterLambdaHR questionHR indexknowledge basetop chunksFMRouterLambdalegal questionLegal indexknowledge basetop chunksFM

Metadata frameworks

Metadata lets you filter before or during the vector search, which raises precision and enforces context such as date, department or access level.

MetadataSourceUse
Document timestampS3 object metadata or a document attributePrefer recent versions, exclude expired policies
Author or ownerCustom attributeShow provenance, filter by team
Domain or categoryTagging systemSearch only the right domain
Access levelCustom attributeReturn only documents the user may see

In Bedrock Knowledge Bases with an S3 data source, you add a sidecar file named after the document, such as policy.pdf.metadata.json, containing metadataAttributes. At query time, a metadata filter in the Retrieve call uses operators such as equals, greaterThan, in, andAll and orAll.

Exam tip

When a scenario says results mix old and new versions, or departments see each other's documents, the fix is metadata plus filtering, not a bigger model or more chunks.

Performance at scale

Sharding. An OpenSearch index is split into primary shards, and the primary shard count is set when the index is created. Changing it later means reindexing or splitting, so plan for growth. Replica shards add read throughput and availability.

Multi index approach. Separate indexes per domain keep each index smaller and let you tune each one, such as different embedding models or refresh schedules.

Hierarchical indexing. Coarse to fine search reduces the number of vectors compared per query.

Index and vector settings. HNSW parameters trade recall for speed and memory. Fewer embedding dimensions reduce memory and speed up search, at some cost in accuracy. OpenSearch Serverless scales capacity in OpenSearch Compute Units (OCUs) without shard management.

How the exam asks about this

  • "RAG over S3 documents with the least operational overhead" -> Bedrock Knowledge Bases with OpenSearch Serverless.
  • "Vectors must be joined with customer records already in PostgreSQL" -> Aurora PostgreSQL with pgvector.
  • "Users get chunks from superseded policy versions" -> Add timestamp and status metadata and filter at retrieval.

Common mistakes

Using DynamoDB as the similarity engine. DynamoDB is a key value store. Pair it with a vector store for the nearest neighbor search.

One giant index for everything. Unrelated domains dilute results and slow queries. Segment by topic and route queries.

Ignoring metadata until later. Adding attributes after ingestion means reprocessing. Design the metadata schema up front.

Undersized primary shards. The primary shard count is fixed at index creation, so growth can force a reindex.

Watch out

Metadata filtering for access control only works if every document carries the attribute. A missing attribute can leak or hide content, so validate metadata during ingestion.

What to remember for the exam

  • Bedrock Knowledge Bases manage ingestion and retrieval over a vector store you choose.
  • OpenSearch Serverless is the low overhead store; managed OpenSearch clusters give tuning control and the Neural plugin.
  • Aurora pgvector keeps vectors with relational data and supports HNSW and IVFFlat indexes.
  • S3 sidecar .metadata.json files add filterable attributes in Bedrock Knowledge Bases.
  • Metadata filters narrow by date, author, domain and access level.
  • Scale with planned sharding, replicas, multi index segmentation and hierarchical search.

Check yourself

  • How do you attach an author and date to a document in a Bedrock knowledge base with an S3 source?

    Add a sidecar .metadata.json file next to the document with those values under metadataAttributes.

  • Why choose Aurora pgvector over OpenSearch for some RAG designs?

    It keeps vectors in the same PostgreSQL database as business data, so one SQL query can filter and rank by similarity.

  • What OpenSearch setting is hard to change after an index grows?

    The number of primary shards, which is set at index creation and needs a reindex or split to change.

Topic 5 of 9 in Foundation Model Integration, Data Management, and Compliance

Test yourself on Foundation Model Integration, Data Management, and Compliance

The full AWS AIP-C01 question bank has 827 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.