diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java index f47a785c3b2..1f9082b0c98 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java @@ -94,6 +94,13 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA return shardIt.nextAssignedOrNull(); } + /** + * We want to go over all assigned nodes (to get recovery status) and not just active ones. + */ + @Override protected ShardRouting firstShardOrNull(ShardIterator shardIt) { + return shardIt.firstAssignedOrNull(); + } + /** * We want to go over all assigned nodes (to get recovery status) and not just active ones. */ diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java index dd58219287e..aae3e98b536 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java @@ -103,6 +103,13 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct return shardIt.nextAssignedOrNull(); } + /** + * We want to go over all assigned nodes (to get recovery status) and not just active ones. + */ + @Override protected ShardRouting firstShardOrNull(ShardIterator shardIt) { + return shardIt.firstAssignedOrNull(); + } + /** * We want to go over all assigned nodes (to get recovery status) and not just active ones. */ diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java index 9d7b89df047..ce273bd4469 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java @@ -133,13 +133,13 @@ public abstract class TransportSearchTypeAction extends BaseActionNote, if overriding this method, make sure to also override {@link #hasNextShard(org.elasticsearch.cluster.routing.ShardIterator)}. + *

Note, if overriding this method, make sure to also override {@link #hasNextShard(org.elasticsearch.cluster.routing.ShardIterator)}, + * and {@link #firstShardOrNull(org.elasticsearch.cluster.routing.ShardIterator)}. */ protected ShardRouting nextShardOrNull(ShardIterator shardIt) { return shardIt.nextActiveOrNull(); } + protected ShardRouting firstShardOrNull(ShardIterator shardIt) { + return shardIt.firstActiveOrNull(); + } + /** * Allows to override how shard routing is iterated over. Default implementation uses * {@link org.elasticsearch.cluster.routing.ShardIterator#hasNextActive()}. @@ -175,13 +180,13 @@ public abstract class TransportBroadcastOperationAction, Iteratornull, without + * incrementing the iterator. + * + * @see ShardRouting#active() + */ + ShardRouting firstActiveOrNull(); + /** * The number of assigned shard routing instances. * @@ -95,6 +103,14 @@ public interface ShardsIterator extends Iterable, Iteratornull, wuthout + * incrementing the iterator. + * + * @see ShardRouting#assignedToNode() + */ + ShardRouting firstAssignedOrNull(); + int hashCode(); boolean equals(Object other);