Index Freshness
In this article
- Split the delay of one change into capture, processing and index-visible time, and add them up.
- Set a freshness target as a percentile from a measured baseline, with a separate bound on deletes.
- Count how many answers used out-of-date evidence, and decide what code does when the target is breached.
- Terms defined here: ingestion lag, stale exposure, freshness SLO.
Overview
Someone deletes a help page at 10:00 because its steps are wrong. At 10:18 the support assistant still quotes it to a customer. Nothing crashed and no error was logged. The page was gone from the source, but not yet from the copy the search reads. How late is too late, and what should happen when a change is stuck?
Take Brightline, a made-up home-internet provider. Its support assistant searches about 200,000 chunks, short pieces of help pages, router manuals, the staff handbook and past conversations, stored in PostgreSQL with pgvector, an extension that adds vector search to PostgreSQL [1], and puts the best 3 into each request. Changes arrive all day; releases ship weekly. You will learn to measure the delay of one change, set a target for it, and decide what code does when it slips.
Where the minutes go
The assistant never reads the help pages themselves. It reads a search index, a separate copy built from them, and a separate copy means time passes between a source update and the matching index update [1]. A change counts as done only when a query can find it: new or edited content is not searchable until its updated embedding is stored. [1]
That delay is the ingestion lag, also called freshness lag: from the change at the source to the moment a query sees it. It has three stages, and each one has its own cause. Capture is how long until the sync notices the change. Processing is the time to parse, chunk, embed and write it. Index-visible time is the gap until the copy that search actually reads shows the write.
Now trace one delete. At 10:00 an editor deletes help-modem-old, a page for a retired modem. The help-page sync polls every 5 minutes. A batch of 40 re-tagged pages is ahead in the queue. Search reads a replica that runs 2 minutes behind the main database. Here is the invented timeline:
| clock | event | stage | minutes |
|---|---|---|---|
| 10:00 | page deleted in the content system | start | 0 |
| 10:05 | next poll sees the delete | capture | 5 |
| 10:18 | queue reaches it; the tombstone is applied on the main database | processing | 13 |
| 10:20 | the replica catches up; search no longer finds the page | index-visible | 2 |
The lag is 5 + 13 + 2 = 20 minutes. Note why each stage took what it took: the poll interval set the capture, the re-tag batch set the processing, and the replica set the last 2 minutes. Each stage has a different fix, which is why you record all three and not one total.
During those 20 minutes the assistant answered two questions with help-modem-old among the top 3, at 10:12 and 10:18. Every answer records which chunks it cited, its provenance, so you can count them: any answer that cited a document after its source change and before the change was visible used out-of-date evidence. That count is the stale exposure, and here it is 2.
Setting the target
Brightline already logs lag for every change. Last week the average was 4 minutes. Before reading on, decide: would an alarm on that average have warned anyone?
It would not. The same week's p95 lag was 9 minutes, so one change in twenty waited more than twice the average. An average blends a thousand quick edits with a few stuck ones, and the stuck ones are the stale pages customers see. Today's 20-minute delete would move a week's average by a fraction of a minute.
So state the target as a share of changes, the way the Google SRE Workbook states service targets: a ratio of good events to all events, with thresholds such as 90% of requests faster than 100 ms [2]. A freshness SLO applies that to data. Brightline's is 95% of changes searchable within 15 minutes, checked every week.
The 15 minutes comes from the measured baseline. Current performance is a reasonable place to start when you have nothing else, though copying it exactly can lock you into a stricter target than users need, and with no history at all you must first collect the data [2]. Brightline's p95 of 9 minutes leaves room for a slow day, and 15 minutes is still short enough that a removed page rarely reaches a customer.
One target is not enough, because a percentile permits a tail. If 95% must land within 15 minutes, 5% may take an hour, and nothing in the SLO says a delete cannot be in that 5%. Deletes deserve their own bound: a removed page is often removed because it is wrong, and some indexes hold deletes back by design, as Vertex batch indexes do until compaction [3]. Brightline's rule: any delete pending for 15 minutes or more raises an alarm, whatever the weekly percentile says.
When lag breaches
An alarm that only pages someone still leaves the page in results while they wake up. The SRE Workbook puts it bluntly: an SLO needs monitoring and alerting to defend it [2]. The question is what the alert does. Doing nothing serves the stale page. Turning the assistant off punishes every customer for one page. The narrow answer is to quarantine the affected document: code adds its id to a list that the search filter excludes, so it stops reaching requests while the slow stage catches up.
The record and the rule fit in a few lines of pseudo-code (not a runnable program):
record: doc_id, source_changed_at, captured_at, processed_at, visible_at, is_delete
lag = visible_at - source_changed_at # capture + processing + index-visible
every minute:
if p95(lag over last 7 days) > 15 min: alarm("freshness SLO")
for doc in captured deletes with no visible_at:
if now - doc.source_changed_at >= 15 min:
alarm("delete pending"); quarantine.add(doc.doc_id)
search filter: doc_id not in quarantinevisible_at is set by a probe that queries the replica search reads, not by the job that wrote the tombstone. That detail matters here: the tombstone landed at 10:18, but the replica served the page until 10:20.
Replay the morning with the rule on. The poll recorded the delete at 10:05, before any tombstone existed. At 10:15 it has been pending for 15 minutes, so the alarm fires and help-modem-old enters quarantine. The 10:18 answer no longer sees it, and stale exposure falls from 2 to 1. The 10:12 answer still used the page, and that is the honest limit of any SLO: it bounds exposure to its window; it does not remove it. A shorter bound costs more polling and faster processing, so choose it knowing what three more minutes of exposure cost you.
Quarantine is a rule in code. The model never decides whether a chunk looks stale; it cannot see the source, only the text it was given. For an edit stuck past the bound, the same rule quarantines the old version until the new one is visible.
Common mistakes
- Measuring lag as an average. It hides the stuck changes. Report p95 or higher, and alarm on it.
- Setting the SLO with no baseline. A target picked from a whiteboard is either always breached or never. Log the three timestamps for a week first, then choose.
- Counting a delete as done when the tombstone is written. A replica or another copy can still serve the page. Set
visible_atfrom what search actually returns. - Mixing clocks. If the content system's clock runs 3 minutes ahead of the database's, every lag looks 3 minutes longer, or shorter. Take all stage times from one clock, or measure the skew and correct for it.
- An alarm with no action. A page at 03:00 that nobody answers protects no customer. The alarm must quarantine as well as notify.
In production
Where the index lives shapes which stage dominates. When embeddings are stored with the records they describe, one database write updates both and there is no separate sync to fall behind [1]. Brightline's sources live in a content system, a drive and a chat store, so it pays for capture and processing, and its replica adds the last stage.
Watch the stages separately on a dashboard: a rising capture time points at the poll interval, rising processing at the queue, rising index-visible time at replication or index maintenance. On Vertex AI, streaming updates are billed per GB used (Nov 2026), and even a streaming index is compacted when its oldest uncompacted data reaches five days [3]. Speed at the index-visible stage is something you buy.
Sources
- Choose an Azure service for vector search. Microsoft (Azure Architecture Center). Checked 21 Nov 2026.
- Implementing SLOs (SRE Workbook). Google. Checked 29 Oct 2026.
- Update and rebuild an active index (Vertex AI Vector Search). Google Cloud. Checked 21 Nov 2026.
Check yourself
Check yourself
Question 1 of 13
What does ingestion lag measure for one changed document?
Your first check counts towards your result.