@Test
void searchWithIOException() throws IOException {

  when(restClient.search(any(), any())).thenThrow(new IOException());
  assertThrows(
      IllegalStateException.class,
      () -> client.search(new ElasticsearchScrollRequest("test", factory)));
}