Skip to content

Instantly share code, notes, and snippets.

@martijnvg
Created January 29, 2013 13:09
Show Gist options
  • Save martijnvg/4664112 to your computer and use it in GitHub Desktop.
Save martijnvg/4664112 to your computer and use it in GitHub Desktop.
Java bulk api example
for (...) {
String id = ...;
String source = ...;
BulkRequestBuilder request = client1.prepareBulk();
for (int j = 0; j < BATCH; j++) {
counter++;
request.add(Requests.indexRequest("test").type("type1").id(id).source(source);
}
BulkResponse response = request.execute().actionGet();
if (response.hasFailures()) {
// Do something with the failures...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment