By default, the delete_by_query API waits for the delete operation to complete before returning a response. This means the API call will be blocked until the operation finishes. If you want the delete operation to be executed in the background and return immediately without waiting for complet...
the explicit wait is the way to go. However, implicit waits used without a solid understanding of scripts can lead to an unnecessarily long time for the completion of scripts.