Created
January 29, 2013 13:09
-
-
Save martijnvg/4664112 to your computer and use it in GitHub Desktop.
Java bulk api example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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