By default PatchByQueryOperation throws immediately if the index that supports query is stale.
I suggest to introduce an option to wait for index to become non-stale before patching.
Notes:
With staleTimeout being null by default the code should be backwards compatible.
The test may look weird, it's difficult to properly test this scenario. So, this is the best way of testing this functionality I could come up with.
By default PatchByQueryOperation throws immediately if the index that supports query is stale. I suggest to introduce an option to wait for index to become non-stale before patching.
Notes: