The way search timeouts are managed by elastic has completely changed in elastic 6.x and this affects how we limit the source_regex query from consuming all the cluster resource.
The timeout check in elastic is now active with a specific thread that inspect timeouts and will respond before the search thread finish.
The timeout thread will then mark the lucene collector as cancelled and the search thread will then throw an exception when it reaches a new segment.
The timeout strategy in the source_regex has not changed and do a timeout check on every docs but we need to make sure that the timeout is reached by the source_regex plugin only after the timeout done by elastic is reached.
Failing to do this will into search failures instead of partial results.
The task can be seen as: find a way to tune timeouts properly so that the source_regex query does not run too long after the partial response is sent.