diff --git a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java index d60a3354b70..ca317f1290f 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java @@ -122,7 +122,6 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction() { @Override @@ -865,9 +873,19 @@ public class GetActionTests extends ElasticsearchIntegrationTest { } }, 1 , TimeUnit.MINUTES); + logger.info("flushing"); FlushResponse flushResponse = client().admin().indices().prepareFlush("my-index").setForce(true).get(); // the flush must at least succeed on one shard and not all shards, because we don't wait for yellow/green - assertThat(flushResponse.getSuccessfulShards(), greaterThanOrEqualTo(1)); + if (flushResponse.getSuccessfulShards() == 0) { + StringBuilder sb = new StringBuilder("failed to flush at least one shard. total shards [") + .append(flushResponse.getTotalShards()).append("], failed shards: [").append(flushResponse.getFailedShards()).append("]"); + for (ShardOperationFailedException failure: flushResponse.getShardFailures()) { + sb.append("\nShard failure: ").append(failure); + } + fail(sb.toString()); + } + + logger.info("checking post-flush retrieval"); getResponse = client().prepareGet("my-index", "my-type1", "1").setFields(field).get(); assertThat(getResponse.isExists(), equalTo(true));