Using elasticsearch-py, I would like to remove all documents from a specific index, without removing the index. Given that delete_by_query
was moved to a separate plugin, I want to know what is the best way to go about this?
Use a Scroll/Scan API call to gather all Document IDs and then call batch delete on those IDs. This is the recommended replacement for the Delete By Query API based on the official documentation.
EDIT: Requested information for using this specifically in elasticsearch-py. Here is the documentation for the helpers. Use the Scan helper to scan throgh all documents. Use the Bulk helper with the delete action to delete all the ids.