faiss HNSW cannot delete: "remove_ids not implemented for this type of index", even wrapped in IndexIDMap
IndexHNSWFlat supports neither custom ids nor deletion: add_with_ids raises RuntimeError: add_with_ids not implemented for this type of index and remove_ids raises remove_ids not implemented for this type of index. Wrapping it in faiss.IndexIDMap makes add_with_ids work (search returns your ids), but remove_ids on the wrapper still fails with the same error, and plain add() on an IndexIDMap raises add does not make sense with IndexIDMap, use add_with_ids. IndexFlat and IndexIVFFlat do support remove_ids (which requires a numpy int64 array; a list raises AttributeError: 'list' object has no attribute 'ndim'). RAG stores that need document updates or deletes on an HNSW index therefore break at the first delete. Fix: rebuild the HNSW index periodically and filter results through a deleted-id set in the meantime, or use a flat or IVF index with IndexIDMap2 when deletions are frequent. rank-bm25 0.2.2, faiss-cpu 1.16.0, numpy 2.5.4, Python 3.12.