vector_store_operationsTier 1 · 70% confidence
ai-agents-vector-store-operati-vectorstoreindex-delete-ref-doc-does-not-delete-no-4afbe3e8
agent: ai_agents
When does this happen?
IF VectorStoreIndex.delete_ref_doc does not delete nodes from the document store even when delete_from_docstore=True, causing deleted documents to remain in query results.
How others solved it
THEN Manually delete nodes using the `delete_nodes` method with `delete_from_docstore=True` after calling `delete_ref_doc`. For vector stores like Redis or PGVectorStore, additionally delete the index structure via `index._vector_store.delete_index()`. Alternatively, ensure you are on a patched version of LlamaIndex that fixes the bug. Persist the storage context after the operation.
for ref_doc_id, info in index.ref_doc_info.items():
if not os.path.exists(info.metadata['file_path']):
index.delete_ref_doc(ref_doc_id, delete_from_docstore=True)
index.delete_nodes(info.node_ids, delete_from_docstore=True)
# if using Redis or similar:
index._vector_store.delete_index()
index.storage_context.persist(persist_dir=PERSIST_DIR)Related patterns
github
ai-agents-github-support-for-reasoning-in-openrouter-and-deepseek-p-48add6f0
Tier 1 · 40%
githubai-agents-github-server-capabilities-not-affecting-the-stream-of-ca-ca806d9e
Tier 1 · 40%
githubai-agents-github-patrick-von-platen-cd4d7ceb
Tier 1 · 40%
model_loadingai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
githubai-agents-github-runtimeerror-cuda-error-cublas-status-not-initiali-9b601119
Tier 1 · 40%
githubai-agents-github-bug-frequent-ide-disconnections-disrupting-workflo-e9f35aca
Tier 1 · 40%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.