insert()
method on the index.# inserting new documents docs = SimpleDirectoryReader().load_data() for doc in docs: index.insert(doc) # For updating existing record # NOTE: the document has a `doc_id` specified doc = Document(text="Brand new document text", doc_id="SAME AS THE DOC YOU WANT TO UPDATE") index.update_ref_doc( doc, update_kwargs={"delete_kwargs": {"delete_from_docstore": True}}, )
index.update_ref_doc( doc, update_kwargs={"delete_kwargs": {"delete_from_docstore": True}}, )
refresh()