The indexing pipeline
We carry committed source changes into a searchable derived copy. Missing events and late versions create stale or resurrected documents. We will build a recoverable ingestion path, distinguish refresh from durability, and trace deletes and rebuilds.
#Section 17Publish changes after the commit
A database transaction writes a report and an outbox row together. The outbox row identifies the report, source version, operation, and changed content or a fetch pointer. A relay later publishes that row to the indexing stream. This removes the dangerous gap where a report commits but the process dies before telling search.
An indexing pipeline is the sequence that reads changes, validates documents, analyzes text, and writes the search representation. At-least-once delivery can repeat a change. Use stable document IDs and source versions so repeating the same event does not create additional logical documents.
Do not couple source transaction success to every search shard being healthy unless the product requires that synchronous dependency. A durable backlog lets writes continue during a search outage, within a declared lag and retention budget. Monitor oldest unindexed change age, failed documents, and the progress checkpoint. A fast relay that repeatedly rejects one malformed document has not completed ingestion.
#Section 18Bulk work still has partial failures
Sending each document in a separate request pays repeated network and request-parsing overhead. A bulk request packages many document operations into one request. An illustrative batch of 1,000 records at 500 bytes each carries 500,000 raw document bytes before framing.
The request-level response is not proof that every item succeeded. The index can accept some records and reject others because of mapping errors, version conflicts, or capacity limits. Examine each item result. Retry only recoverable failures using stable IDs and versions, and move permanently invalid records to a repair path with their error and source identity.
After a retryable rejection, the consumer retains the item identity and source version and schedules another bounded attempt. A malformed field instead needs a corrected document or an explicit quarantine disposition. Keeping the whole batch in an endless retry loop makes the valid documents repeat while the invalid document never improves. Distinguishing item outcomes is what permits safe forward progress.
A larger batch increases throughput only until memory, queueing, or payload constraints dominate. It also increases the work a failure can repeat and the time the earliest document waits for a full batch. Flush by a size or time rule, bound concurrent bulk requests, and back off on overload. Explain those boundaries before calling bulk ingestion an optimization.
#Section 19Refresh is a reader visibility boundary
The writer has added a report to the indexing buffer. An existing searcher still uses its old segment view. A refresh makes newly indexed operations visible to a search view by opening the relevant segment data. It need not perform the full durable commit associated with a storage flush.
Elastic’s near-real-time search documentation separates refresh visibility from the heavier commit process. Treat these as different events. Heron’s one-second refresh exercise groups an assumed 20 changes; it is not a promise about a product’s defaults or maximum delay.
For a read-after-write screen, waiting for the next refresh can be better than forcing a new refresh for every write. Forced refreshes can generate small segments and more merge work. For a transactionally authoritative read, use the source record and make clear that search catches up. The design choice follows the user action, not the desire for a single slogan about consistency.
#Section 20Version deletes so old events cannot resurrect data
The source emits update version 7, then delete version 8. A delayed update version 6 arrives afterward. If the index blindly overwrites by document ID, it can recreate a document the source has deleted. A tombstone records deletion at a particular version so later arrivals can be compared against it.
The consumer checks the incoming source version against the latest applied version. Version 7 can establish the live document. Version 8 changes it to deleted. Version 6 is older and rejected. A repeated version 8 is harmless. Version comparison and the write must be atomic at the index’s stated conflict boundary.
Tombstone retention must exceed the possible replay horizon or use another durable version registry. A full rebuild also needs deletes that occurred during its snapshot. Rebuilding only live rows while allowing old retained changes to replay can reintroduce removed content. In an interview, follow the delete through every derived copy, cache, and suggestion index.