Lesson 7 of 7 Retrieval Augmented Generation

Keeping Knowledge Bases Current and Re-Indexing Safely

This lesson explains knowledge base refresh cycles that keep vectors in step with source documents, and the planned re-index that larger changes such as a new embedding model require.

Learning outcomes

After completing this lesson, you will be able to:

  • Use incremental sync.
  • Orchestrate refresh cycles by schedule and events.
  • Re-index fully with a blue/green approach.

Incremental sync

A knowledge base ingestion job started with StartIngestionJob compares the data source with what was indexed and processes only added, modified and deleted documents, which keeps cost and time low. Custom data sources can push changes directly with IngestKnowledgeBaseDocuments and DeleteKnowledgeBaseDocuments for near-real-time updates without a full sync.

The following diagram shows an event-driven cycle that keeps a news assistant's knowledge base within 15 minutes of publication.

Keeping the news assistant within 15 minutes of publication. EventBridge rules match object-created and object-deleted events from the article bucket; a Lambda function batches them for five minutes and starts an ingestion job if none is running; and Step Functions waits for completion and alerts on failed documents. Modified articles are re-ingested, so corrections replace old versions.
The scenario is illustrative.

Orchestrating refresh cycles

Common triggers are a schedule (EventBridge Scheduler starting a sync nightly), events (S3 object-created and object-removed events routed through EventBridge to a Lambda function or Step Functions workflow that starts a sync, batching events to avoid excessive jobs) and upstream pipelines (a document-processing workflow that ends by syncing). Step Functions can poll GetIngestionJob until completion, check failure counts and alert through SNS.

Scenario questions

Keep it current

Exam skills 3.3.11

Choose how to keep a knowledge base current.

Log in to try this activity Interactive activities are free with an account.

Full re-indexing

Changing the embedding model, vector dimensions, vector store or chunking strategy invalidates existing vectors. Use a blue/green approach: create a new knowledge base or data source with the new configuration, ingest everything, run RAG evaluations against the old one, then switch the application's knowledge base ID and delete the old index. The following table summarises refresh options.

ChangeRefresh method
Documents added, edited or deletedIncremental ingestion job (sync)
Near-real-time updates from an applicationDirect document ingestion APIs
New embedding model or dimensionsNew knowledge base, full ingestion, evaluate, switch
New chunking or parsing strategyNew data source, full ingestion, evaluate, switch
Put in order

Re-index without downtime

Exam skills 3.3.11 · 3.2.7

Arrange the steps for moving a knowledge base to a new embedding model without downtime.

Log in to try this activity Interactive activities are free with an account.
Worked example

A news assistant

A media company's assistant must answer from articles within 15 minutes of publication, and corrected articles must replace old versions.

  • The publishing system writes articles to S3; EventBridge rules match object-created and object-deleted events.
  • A Lambda function batches events for five minutes, then starts an ingestion job if none is running.
  • A Step Functions workflow waits for completion and alerts on failed documents.

Updates land within the 15-minute target, and corrections replace earlier versions because modified objects are re-ingested. A nightly sync alone would leave the assistant up to a day out of date.

Check yourself

How are documents deleted from S3 removed from a knowledge base?

Show answer

The next sync removes them.

Exam Tips

Remember for the exam

  • Keep indexes current: incremental ingestion jobs on a schedule or on S3 events.
  • Deleted documents are removed by the next sync.
  • Near-real-time updates: direct document ingestion APIs.
  • New embedding model or chunking: build a new index, evaluate, then switch (blue/green).
  • Orchestrate and monitor syncs with EventBridge and Step Functions.