diff --git a/core/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java b/core/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java index d53e9f8997e..c270c51ea38 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java @@ -85,8 +85,14 @@ public class BulkShardRequest extends ReplicatedWriteRequest { @Override public String toString() { // This is included in error messages so we'll try to make it somewhat user friendly. - StringBuilder b = new StringBuilder("BulkShardRequest to ["); - b.append(index).append("] containing [").append(items.length).append("] requests"); + StringBuilder b = new StringBuilder("BulkShardRequest ["); + b.append(shardId).append("] containing ["); + if (items.length > 1) { + b.append(items.length).append("] requests"); + } else { + b.append(items[0].request()).append("]"); + } + switch (getRefreshPolicy()) { case IMMEDIATE: b.append(" and a refresh");