Skip to content

Commit

Permalink
fix bug causing bulk requests to minimize in size
Browse files Browse the repository at this point in the history
fixes #114
fixes #74
  • Loading branch information
costin committed Dec 5, 2013
1 parent 1a72bc6 commit 4b1afee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -126,6 +126,7 @@ private void doWriteToIndex(BytesRef payload) throws IOException {
}

payload.copyTo(data);
payload.reset();

dataEntries++;
if (bufferEntriesThreshold > 0 && dataEntries >= bufferEntriesThreshold) {
Expand All @@ -147,6 +148,9 @@ private void flushBatch() throws IOException {
@Override
public void close() {
try {
if (log.isDebugEnabled()) {
log.debug("Closing repository and connection to Elasticsearch ...");
}
if (data.size() > 0) {
flushBatch();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/elasticsearch/hadoop/util/BytesRef.java
Expand Up @@ -64,5 +64,6 @@ public void reset() {
if (list != null) {
list.clear();
}
size = 0;
}
}

0 comments on commit 4b1afee

Please sign in to comment.