RAG Freshness: Updates, Deletion, and Index Consistency
Keep RAG answers current with versioned ingestion, deletion watermarks, permission checks, and cache invalidation that survives delayed jobs and replay.
Abhishek Raj · · 8 min read
Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.
RAG freshness is an end-to-end property: an answer should use an eligible version of a document under the permissions that apply when the answer is served. Successfully writing a vector is only one step. Parsing queues, keyword indexes, replicas, caches, and long-running agent contexts can all preserve older information.
This guide proposes an illustrative design for a policy-document assistant. It separates ordinary content lag from access revocation, tracks versions through derived artifacts, and makes deletion a workflow with observable completion criteria. The design is not a tested reference implementation or a promise about any database’s consistency.
Define freshness at the answer boundary
Start with three different questions. Has the latest source change been processed? Can search return the new representation? Is a particular user still allowed to see the retrieved material? These questions need different evidence and often different response policies.
For example, a product description might tolerate a short indexing delay. A revoked permission should not inherit that same tolerance merely because both changes travel through one queue. Write the permitted behavior for each class before choosing a synchronization mechanism.
Elasticsearch illustrates why acknowledgement and search visibility differ. Its documentation describes a refresh operation that makes recently indexed changes available to search; an accepted write is not automatically an immediately searchable result. The precise behavior depends on index settings and refresh controls. Elastic: Near real-time search.
Measure freshness from a source revision to a user-visible eligibility decision, rather than from the start of an embedding job to its completion. A fast embedder cannot compensate for a change event that remained undiscovered overnight.
Give documents and derived artifacts explicit identities
In the proposed assistant, a source document has a stable logical identity and a monotonically increasing revision within that identity. A content hash detects identical bytes; it does not replace a source revision because identical content can have different permissions or effective dates.
Each derived chunk carries a small provenance record:
{
"tenant_id": "tenant_example",
"document_id": "policy_example",
"source_revision": 18,
"chunk_id": "policy_example:r18:section3:chunk2",
"content_hash": "illustrative-hash",
"pipeline_version": "parser-v4_chunker-v2_embedder-v3",
"permission_revision": 6
}
These fields are an illustrative contract. The actual service must determine how revisions are allocated and which system owns them. A timestamp alone is a weak ordering mechanism when workers use different clocks or a source allows backdated edits.
Maintain a document manifest that identifies the active revision and the chunk identifiers belonging to each indexed revision. When a short document replaces a long one, the manifest identifies obsolete tail chunks that an upsert-only process would otherwise leave searchable. The document-ingestion guide covers how parsing and chunk boundaries affect this lineage.
Publish complete revisions instead of partial replacements
Consider staging a new revision before making it eligible. Parse and validate the source, create its chunks, write all required retrieval representations, and confirm their visibility. Only then advance the active revision in the manifest.
This proposed sequence trades some update latency and temporary duplicate storage for a clearer answer boundary. Without it, a query might combine a new policy heading with an old exception paragraph. That mixture can be misleading even when every individual chunk is genuine.
The manifest can describe readiness independently for lexical and vector indexes. A hybrid query should either use a coherent eligible set or disclose a deliberately chosen degraded mode. Do not silently treat missing vector results as proof that a document contains no relevant information. Hybrid search for RAG agents explains the retrieval consequences of combining candidate sources.
For large migrations, stage a new corpus generation and switch a routing pointer after validation. Keep source updates flowing during the build, then reconcile the interval before cutover. Rebuilding from yesterday’s export and switching today without catching intervening changes creates a freshness gap by construction.
Make update delivery replayable and ordered per document
A change feed can reduce the delay between source commits and indexing work. Debezium’s PostgreSQL connector documents an initial snapshot followed by change events, including insertions, updates, and deletions. It also records source positions for recovery. Those mechanisms provide a foundation for ingestion; they do not automatically make downstream vector writes ordered or idempotent. Debezium PostgreSQL connector.
In this design, an ingestion consumer compares an event’s source revision with the document’s accepted revision. A duplicate is harmless, an older update is rejected, and a newer update starts or supersedes staging. The consumer records its outcome durably before acknowledging work according to its delivery contract.
Keep long-running embedding jobs from publishing after they have been superseded. A revision check at job creation is insufficient: revision 18 can start first, finish after revision 19, and overwrite it unless the publication step rechecks authority.
When a source lacks a reliable event stream, combine scheduled discovery with reconciliation scans. Inventory checks should compare expected documents and revisions against indexed manifests, rather than relying solely on queue depth. An empty queue can mean that the discovery process stopped producing events.
Treat revocation as a separate eligibility path
Permissions indexed with content can become stale. Azure AI Search’s query-time access-control documentation explicitly notes that ACL freshness depends on ingestion method and that some permission changes require resynchronization or document reingestion. The described capability is preview functionality, so its current limitations must be checked before adoption. Microsoft: Query-time ACL and RBAC enforcement.
For the hypothetical assistant, the retrieval service obtains tenant and user identity from authenticated execution context. It performs coarse filtering during search and checks authoritative eligibility before passing candidate text to a reranker or model. A model-provided tenant identifier cannot authorize access.
This final check adds latency and a dependency on the eligibility service. It also prevents the index’s slower permission propagation from being the only protection. Define the failure behavior explicitly: if required authorization cannot be established, withhold the material rather than continuing with a cached permission guess.
There is still a race between checking permission and releasing an answer. For sensitive workflows, associate generation with a permission epoch and recheck it at delivery. If the epoch changed, discard or regenerate the affected answer. This is a proposed application policy, not a claim that the referenced search service implements that transaction.
Delete serving access before relying on physical cleanup
A deletion workflow should distinguish immediate ineligibility from eventual physical removal. In the proposed design, a durable deletion marker first blocks serving. Background workers then remove source replicas and derived artifacts according to the system’s retention policy.
Keep enough version information to reject delayed updates that would resurrect the document. Removing every trace of a revision while allowing an old ingestion event to replay creates a reappearance risk. Where appropriate, retain a minimal deletion watermark without retaining document content; choose its retention from replay and restoration behavior, not an arbitrary short TTL.
Debezium uses the term tombstone for a specific Kafka-compaction record: a key with a null value following a delete event when configured accordingly. That record is not proof that a RAG system has erased embeddings, caches, or generated answers. Use separate completion evidence for each downstream store. Debezium delete and tombstone semantics.
Track cleanup states such as requested, blocked-from-serving, vector-removed, lexical-removed, cache-invalidated, and reconciliation-confirmed. The required states depend on the actual architecture. Backups, audit logs, and exported datasets require their own documented handling; an index deletion API cannot establish their removal.
Invalidate cached answers and in-flight context
An answer cache should record the document revisions that supported its answer, together with relevant tenant, identity, and policy dimensions. A key based only on question text can return an answer generated under another user’s permissions or an obsolete policy.
Invalidation messages also have races. Redis documents a case where an invalidation arrives before a delayed read response, allowing stale data to repopulate a cache unless the client handles the sequence. It also recommends clearing affected local caches when invalidation connectivity is lost. Redis client-side caching reference.
For this assistant, a cache write includes the dependency revisions observed at generation time and is accepted only if those dependencies remain eligible. An invalidation increments a generation counter, so an older in-flight response cannot restore an entry after its invalidation. This is an illustrative approach; its atomicity needs implementation-specific verification.
A long-running agent is another cache. Before it turns an earlier retrieved passage into a final claim or an action, check whether that passage’s document revision remains acceptable. Updating the search index does not reach backward into the agent’s existing context window.
Validate failure sequences and measure the stale tail
Use a hypothetical sequence test: revision 18 starts embedding, revision 19 becomes active, access is revoked, and the delayed revision-18 job finishes. The expected result is no publication of revision 18 and no delivery of protected material. Inspect stores and user-visible responses, not only worker logs.
Add deletion followed by replay, cache fill after invalidation, an index outage during publication, permission-service failure, and restoration from an older snapshot. Each test should state whether the correct response is an older explicitly permitted version, incomplete information, or refusal to serve the affected evidence.
Measure source-to-eligible lag, deletion-to-blocking lag, obsolete-revision rejection counts, reconciliation discrepancies, and cache dependency failures. Report distributions and the oldest unresolved item. An average can look healthy while one revoked document remains accessible for hours.
Frequently asked questions
Is a short cache TTL enough?
It bounds some stale reads only if all relevant caches honor it and no response outlives the assumed interval. It does not establish immediate revocation or prevent delayed jobs from restoring obsolete entries.
Should every update trigger a full reindex?
Usually a manifest enables selective replacement. Reindex when parsing, chunking, embedding, or schema changes invalidate broader assumptions, and preserve a catch-up path for changes that arrive during the rebuild.
Can the model decide which policy version is current?
It can explain versions supplied as evidence. The application should determine eligibility from authoritative revision and permission records, rather than asking the model to infer current authority from competing passages.
Source reference list
Related reading
- RAG Chunking and Document Ingestion: Preserve Meaning and Provenance
Build a RAG ingestion pipeline that preserves document structure, source locations, permissions, and version history while producing useful retrieval chunks.
- Hybrid Search for RAG Agents: BM25, Vectors, and Fusion
Build hybrid search for RAG agents with lexical and vector retrieval, rank fusion, consistent access filters, evidence selection, and realistic evaluation.
- Multi-Tenant AI Agents: Data Isolation Across Retrieval and Tools
Design multi-tenant AI agents with trusted tenant context, scoped retrieval and tools, isolated caches, current permissions, and adversarial isolation tests.