Elasticsearch incremental index update creates duplicate vector IDs and stale pointers causing RAG to cite deleted passages
Environment
Self-hosted Elasticsearch cluster used as vector store for RAG pipeline. Incremental index updater job (Python) runs nightly to add/replace vectors; deletions are performed by marking documents and issuing delete-by-query followed by segment merge.
Symptoms
After incremental job runs, RAG assistant returns passages that were deleted earlier and sometimes returns the same passage for multiple queries (duplicates). Vector dashboard shows duplicate vector IDs and some vectors reference outdated document pointers.
Observations
Index contains duplicate _id values (older id retained in segments), delete-by-query did not immediately remove all vector vectors. Merges/refreshes ran but duplicates persisted across shards. The update job uses bulk API with upsert semantics and a separate job that issues delete-by-query for removed docs; concurrency between these jobs observed in logs.
Already attempted
Forced a full index refresh and manual force-merge to 1 segment; duplicates reduced but reappeared after next incremental run. Adjusted bulk update to use explicit doc IDs, added versioning, and temporarily disabled delete job — duplicates still created when add/replace concurrency exists.
Question
Why are deleted vectors resurfacing and duplicate vector IDs being created by incremental update, and how to safely avoid stale pointers in RAG retrieval?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Artificial Intelligence49% match
Incremental vector index job creates duplicate vector IDs and stale text pointers — RAG assistant returns deleted passages
Open0 answers - Artificial Intelligence47% match
Incremental vector index job leaves stale vectors and duplicate document IDs — RAG answers cite deleted passages
Open0 answers - Artificial Intelligence38% match
Dense vector index returns stale document IDs and wrong passages after incremental update job — RAG answers become semantically irrelevant
Open0 answers - Artificial Intelligence35% match
Vector search returns semantically unrelated high-similarity passages after incremental index update
Open0 answers - Artificial Intelligence34% match
Vector DB returns stale document IDs after background compaction and shard reallocation — RAG assistant cites deleted passages
Open1 answer