Skip to content

Instantly share code, notes, and snippets.

@tallpsmith
Created October 24, 2011 01:28
Show Gist options
  • Save tallpsmith/1308172 to your computer and use it in GitHub Desktop.
Save tallpsmith/1308172 to your computer and use it in GitHub Desktop.
BulkRequest bulkRequest = new BulkRequestBuilder(client).request();
URL bulkIndexRequest = this.getClass().getResource("es-bulkindex.json");
CountingOutputStream countingOutputStream = new CountingOutputStream(new NullOutputStream());
ByteStreams.copy(bulkIndexRequest.openStream(), countingOutputStream);
long numBytes = countingOutputStream.getCount();
bulkRequest.add(ByteStreams.toByteArray(bulkIndexRequest.openStream()), 0, (int) numBytes, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment