diff --git a/haystack/document_store/elasticsearch.py b/haystack/document_store/elasticsearch.py index 5049446b6..fc8aabd50 100644 --- a/haystack/document_store/elasticsearch.py +++ b/haystack/document_store/elasticsearch.py @@ -780,7 +780,8 @@ class ElasticsearchDocumentStore(BaseDocumentStore): query["query"] = {"match_all": {}} self.client.delete_by_query(index=index, body=query, ignore=[404]) # We want to be sure that all docs are deleted before continuing (delete_by_query doesn't support wait_for) - time.sleep(1) + if self.refresh_type == "wait_for": + time.sleep(1) class OpenDistroElasticsearchDocumentStore(ElasticsearchDocumentStore):