File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
server/src/main/java/org/opensearch/cluster/routing Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -285,8 +285,8 @@ public GroupShardsIterator<ShardIterator> searchShards(
285
285
}
286
286
}
287
287
List <ShardIterator > allShardIterators = new ArrayList <>();
288
- for ( List < ShardIterator > indexIterators : shardIterators . values () ) {
289
- if ( slice != null ) {
288
+ if ( slice != null ) {
289
+ for ( List < ShardIterator > indexIterators : shardIterators . values () ) {
290
290
// Filter the returned shards for the given slice
291
291
CollectionUtil .timSort (indexIterators );
292
292
// We use the ordinal of the iterator in the group (after sorting) rather than the shard id, because
@@ -300,9 +300,9 @@ public GroupShardsIterator<ShardIterator> searchShards(
300
300
allShardIterators .add (indexIterators .get (i ));
301
301
}
302
302
}
303
- } else {
304
- allShardIterators .addAll (indexIterators );
305
303
}
304
+ } else {
305
+ shardIterators .values ().forEach (allShardIterators ::addAll );
306
306
}
307
307
308
308
return GroupShardsIterator .sortAndCreate (allShardIterators );
You can’t perform that action at this time.
0 commit comments