diff --git a/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java b/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java index b9cb5e92d0ed1..ff91c27375788 100644 --- a/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java +++ b/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java @@ -1254,6 +1254,7 @@ public ReplicationCheckpoint getLatestReplicationCheckpoint() { private boolean isPrimaryRelocation(String allocationId) { Optional shardRouting = routingTable.shards() .stream() + .filter(routing -> Objects.nonNull(routing.allocationId().getId())) .filter(routing -> routing.allocationId().getId().equals(allocationId)) .findAny(); return shardRouting.isPresent() && shardRouting.get().primary();