DeleteByQueryResponse actionGet = deleteByQueryRequestBuilder.execute().actionGet();
assertThat(actionGet.getIndices().size(), equalTo(0));
}
@Test
public void testDeleteAllOneIndex() {
<BUG>String json = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elastic Search\"" + "}";
client().prepareIndex("twitter", "tweet").setSource(json).setRefresh(true).execute().actionGet();

SearchResponse search = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
assertThat(search.getHits().totalHits(), equalTo(1l));
</BUG>
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery();

DeleteByQueryResponse actionGet = deleteByQueryRequestBuilder.execute().actionGet();
assertThat(actionGet.getIndices().size(), equalTo(0));
}
@Test
public void testDeleteAllOneIndex() {
String json = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elastic Search\"" + "}";
final long iters = randomIntBetween(1, 50);
for (int i = 0; i < iters; i++) {
client().prepareIndex("twitter", "tweet", "" + i).setSource(json).execute().actionGet();
}
refresh();
SearchResponse search = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
assertThat(search.getHits().totalHits(), equalTo(iters));
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery();
