"No search context found for id" during reindex

I've started to get the following exception during reindex operations:

elasticsearch.exceptions.NotFoundError: NotFoundError(404, 'search_phase_execution_exception', 'No search context found for id [3764110]')

What can I do to avoid this?

(Elasticsearch 7.4.0 in Docker.)

@tomhe this can happen either if one of the nodes cobtainibg the source indices is restarted while reindex runs or if the underlying scroll search times out. You can try to increase the scroll timeout on the reindex request to see if that helps.