azure-cognitive-search

How to remove all documents in index


Is there any simple way to remove all documents (or a filtered list or documents) from an Azure search index?

I know the obvious answer is to delete and recreate the index, but I'm wondering if there is any other option.


Solution

  • No, currently there's no way to delete all the documents from an index. As you suspected deleting and re-creating the index is the way to go. For really small indexes you could consider deleting documents individually but given that often apps have code for index creation already, delete/recreate is the quickest path.