for (SearchHit searchHit : searchResponse.hits().hits()) {
Map<String, Object> map = searchHit.sourceAsMap();
map.put("message", "update");
client.prepareIndex("test", "tweet", searchHit.id()).setSource(map).execute().actionGet();
}
searchResponse = client.prepareSearchScroll(searchResponse.scrollId()).setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet();
} while (searchResponse.hits().hits().length > 0);
client.admin().indices().prepareRefresh().execute().actionGet();
assertThat(client.prepareCount().setQuery(matchAllQuery()).execute().actionGet().count(), equalTo(500l));
assertThat(client.prepareCount().setQuery(termQuery("message", "test")).execute().actionGet().count(), equalTo(0l));