Edit one paragraph and re-embed everything? The chunk id decides what incremental updates cost
Three months after launch, a product manager rewrites one paragraph. Your update job runs for forty minutes, because it re-chunks the whole document, re-embeds every chunk and overwrites the collection. The embedding model is not the bottleneck. The bottleneck is that your chunks have no stable identity: once the split boundaries move, every id changes, so the old set is deleted and the new set is built from scratch. Nothing can be reused.
This article answers one question: what chunk id makes a single edit re-embed only what actually changed, and what does that cost? The answer is not "use a UUID". It starts with separating three questions that usually get collapsed into one: can you still find the old chunks, should the old chunks stay, and when does a write become searchable.
Three questions, not one
Can you find them? To delete every chunk of a document, you need reverse lookup. Qdrant deletes points by an id list or by a filter (for example, matching a doc_id payload field); in Elasticsearch the equivalent is _update by id or a delete-by-query. Both depend on the same prerequisite: the payload must carry doc_id, not just text.
Will you duplicate? Qdrant is explicit here: all point operations are idempotent, and re-uploading the same id overwrites the point. With named vectors there is an extra detail — uploading an existing id deletes the old point first, so "the entire point is replaced, and any unspecified vectors are set to null". If you want to keep vectors you did not resend, use update vectors, which requires that all given points already exist.
When is it visible? This is the trap. Qdrant called without wait=true returns acknowledged, not completed; the docs say plainly that this response "does not mean that the data is available for retrieval yet", that the update runs in the background and may even fail. To get "searchable as soon as the API returns", pass wait=true. Elasticsearch behaves the same way: POST /{index}/_update/{id} has refresh defaulting to false, so a write followed immediately by a search may miss. Hosted stores lag too: files added to an OpenAI vector store are only usable once polling shows status: completed, and the docs note that listing visibility can lag behind completed indexing.
Four id schemes, measured
Setup: the body text of 11 Chinese articles from this site (frontmatter and code blocks stripped), mean 2,410 characters; fixed windows of 500 characters with 50 overlap; paragraph packing targeting about 500 characters; 5.5 fixed-window chunks per article on average. The edit is identical in every run: insert one new 300-character paragraph after the second paragraph, then compare which chunks need re-embedding.
| Chunk id scheme | After inserting one 300-character paragraph | After a 1-character, length-preserving edit |
|---|---|---|
Fixed window + sequence id (doc#0) | 100% re-embedded | 18.7% re-embedded |
| Fixed window + text hash id | 0% of old ids retained, all replaced | same |
| Paragraph packing (~500 chars) + text hash | 56.1% of old ids retained, 2.8 new chunks | — |
| One chunk per paragraph + text hash | 100% of old ids retained, 1 new chunk | — |
Two findings are worth keeping.
First, sequence ids fail on length change, not on content change. Replace one character with another of the same length and only the chunk covering that position changes (18.7% ≈ 1/5.5). Insert 300 characters and every later window shifts, so all 5.5 chunks get new text. "The edit was small" and "the re-embed was small" are different claims: the first is about content diff, the second about length diff.
Second, swapping in hash ids does not rescue fixed windows. Move the boundary and every window holds different text, so every hash changes and retention is 0% — worse than sequence ids, because you cannot even tell which chunk sat where. Hash ids only pay off with stable boundaries: one chunk per paragraph retains 100%, because the paragraphs themselves did not move.
Paragraph packing — accumulating paragraphs up to roughly 500 characters — looks like a compromise between size and boundary stability, but it is just as exposed to insertion: a new paragraph changes which paragraphs get packed together downstream, retention drops to 56.1%, and about 3 new chunks appear. That is inherent to the greedy packing strategy, not an implementation bug.
How to choose: three criteria
- How often documents change. A few articles a week, a few sentences each → one chunk per paragraph plus a paragraph fingerprint is the best trade: one insertion means one embedding, everything else stays. Retrieval then uses
doc_idand paragraph sequence from the payload to pull neighbours for context. The cost is more assembly logic, shorter chunks, and possibly a second query to stitch neighbours before answering. - Whether brief inconsistency is acceptable. Full rebuild plus an alias swap (build a new index, load it, switch the alias) is the safest zero-downtime path, paid for with double storage and one full embedding pass. If you upsert in place instead, you accept the eventual consistency of
wait=false, or pay per-writewait=truefor "visible on return" and give up throughput. - Whether you need versions. For rollback or comparison, do not delete physically: mark old chunks
active: falseand filter at query time. That filter must appear in every retrieval path — vector, BM25, rerank candidates. Miss one and stale versions get fed to the model as current content, which costs far more than the extra storage.
A minimal update flow
# 1) Look up the old chunks for this doc_id before touching anything
old = client.scroll(collection, scroll_filter=Filter(
must=[FieldCondition(key="doc_id", match=MatchValue(value=doc_id))]))
# 2) Chunk per paragraph; id = doc_id + first 8 chars of the paragraph hash
new_chunks = [(f"{doc_id}#{sha1(p)[:8]}", p) for p in paragraphs]
# 3) Embed only the new ones, delete the ones that no longer exist
to_add = [c for c in new_chunks if c[0] not in old_ids]
to_drop = [i for i in old_ids if i not in {c[0] for c in new_chunks}]
client.delete(collection, points_selector=PointIdsList(points=to_drop), wait=True)
client.upsert(collection, points=[...], wait=True)The value here is not the syntax but step 2: the id is derived from the content, so "what needs re-embedding" becomes a set difference instead of a full recompute.
Scope note: the measurements cover 11 Chinese articles, a single insertion position and a character-based splitter; they indicate direction and magnitude, not a universal result. API behaviour follows the Qdrant, Elasticsearch and OpenAI documentation as published at the time of writing — re-check defaults and versions before relying on them.