Skip to content

Commit

Permalink
Minor issue with bulk response (needs some more thinking about the pr…
Browse files Browse the repository at this point in the history
…opagating shard infos to item level due to partial execution)
  • Loading branch information
bleskes committed Dec 21, 2014
1 parent a9b659d commit 6180417
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.ExceptionsHelper;
Expand Down Expand Up @@ -60,11 +59,7 @@
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand Down Expand Up @@ -319,7 +314,10 @@ private void executeBulk(final BulkRequest bulkRequest, final long startTime, fi
@Override
public void onResponse(BulkShardResponse bulkShardResponse) {
for (BulkItemResponse bulkItemResponse : bulkShardResponse.getResponses()) {
bulkItemResponse.getResponse().setShardInfo(bulkShardResponse.getShardInfo());
// we may have no response if item failed
if (bulkItemResponse.getResponse() != null) {
bulkItemResponse.getResponse().setShardInfo(bulkShardResponse.getShardInfo());
}
responses.set(bulkItemResponse.getItemId(), bulkItemResponse);
}
if (counter.decrementAndGet() == 0) {
Expand Down

0 comments on commit 6180417

Please sign in to comment.