Skip to content

Commit 3fa7842

Browse files
authored
Allow searching unsearchable shards (elastic#92996)
In elastic#92668 we adjusted `SearchShardIterator` so that it only iterates over shards whose role indicates that they are searchable. We're not ready for this restriction yet, so this commit reverts it.
1 parent 67f0dfe commit 3fa7842

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/ShardRoutingRoleIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ public AllocationCommand getCancelPrimaryCommand() {
356356
return null;
357357
}
358358

359+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/93010")
359360
public void testSearchRouting() throws InterruptedException {
360361

361362
var routingTableWatcher = new RoutingTableWatcher();

server/src/main/java/org/elasticsearch/action/search/SearchShardIterator.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,8 @@ public final class SearchShardIterator implements Comparable<SearchShardIterator
5050
* @param originalIndices the indices that the search request originally related to (before any rewriting happened)
5151
*/
5252
public SearchShardIterator(@Nullable String clusterAlias, ShardId shardId, List<ShardRouting> shards, OriginalIndices originalIndices) {
53-
this(
54-
clusterAlias,
55-
shardId,
56-
shards.stream().filter(ShardRouting::isSearchable).map(ShardRouting::currentNodeId).toList(),
57-
originalIndices,
58-
null,
59-
null
60-
);
53+
// TODO ensure all target nodes hold shards with a searchable ShardRoutingRole - at the moment, searches don't check this
54+
this(clusterAlias, shardId, shards.stream().map(ShardRouting::currentNodeId).toList(), originalIndices, null, null);
6155
}
6256

6357
public SearchShardIterator(

0 commit comments

Comments
 (0)