diff --git a/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java b/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java index e2bb077c..8ab8a437 100644 --- a/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java +++ b/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java @@ -389,7 +389,7 @@ private void sweepShard(ShardId shardId, ShardNodes shardNodes, String startAfte String searchAfter = startAfter == null ? "" : startAfter; while (searchAfter != null) { SearchRequest jobSearchRequest = new SearchRequest().indices(shardId.getIndexName()) - .preference("_shards:" + shardId.id() + "|_primary") + .preference("_shards:" + shardId.id() + "|_primary_first") .source( new SearchSourceBuilder().version(true) .seqNoAndPrimaryTerm(true)