@Test public void testRandomDocsNodeClient() throws Exception { final NodeClient es = new NodeClient() .maxActionsPerBulkRequest(1000) .flushInterval(TimeValue.timeValueSeconds(10)) .newClient(client("1")) .newIndex("test"); try { for (int i = 0; i < 12345; i++) { es.index("test", "test", null, "{ \"name\" : \"" + randomString(32) + "\"}"); } es.flush(); } catch (NoNodeAvailableException e) { logger.warn("skipping, no node available"); } finally { es.shutdown(); assertEquals(13, es.getState().getTotalIngest().count()); if (es.hasThrowable()) { logger.error("error", es.getThrowable()); } assertFalse(es.hasThrowable()); } }