diff --git a/sensei-core/src/main/java/com/senseidb/search/node/AbstractConsistentHashBroker.java b/sensei-core/src/main/java/com/senseidb/search/node/AbstractConsistentHashBroker.java index 94556ea67..0a78e1c38 100644 --- a/sensei-core/src/main/java/com/senseidb/search/node/AbstractConsistentHashBroker.java +++ b/sensei-core/src/main/java/com/senseidb/search/node/AbstractConsistentHashBroker.java @@ -1,5 +1,6 @@ package com.senseidb.search.node; +import com.google.common.collect.Sets; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.HashMap; @@ -227,7 +228,14 @@ public RESULT call() throws Exception { @SuppressWarnings("unchecked") protected List doCall(REQUEST req) { - Set shards = router.getShards(); + Set allShards = router.getShards(); + + Set shards = req.getPartitions(); + if (shards == null || shards.isEmpty()) { + shards = allShards; + } else { + shards = Sets.intersection(allShards, shards); + } Map, REQUEST> serviceToRequest = new HashMap, REQUEST>();