Refresh sync or async?

Hi, i don't understand how it should work. It doesn't matter what value the 'refresh' param have (true, wait_for), but right after _delete_by_query the search request get all the deleted documents. It's a bug or feature?

Are you also waiting for the completion of _delete_by_query i.e. specifying wait_for_completion=true? If you're not, then the operation will be running asynchronously. If you need to ensure that a subsequent search request does not retrieve documents that will be deleted, you can either

  • specify wait_for_completion=true and refresh=wait_for and wait for the delete by query to finish before issuing the search request

or

  • issue the delete by query request with refresh=wait_for and monitor the status of the operation with the Tasks API, issuing the search request after it has finished
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.