improved indexing functionality, if doc has same ID as existing doc, existing doc is deleted and replaced