private List<IndexShard> getExistingShards(final IndexShardKey indexShardKey) {
            // Get all index shards that are owned by this node.
            final FindIndexShardCriteria criteria = FindIndexShardCriteria.matchAll();
            criteria.getNodeNameSet().add(nodeInfo.getThisNodeName());
            criteria.getIndexUuidSet().add(indexShardKey.getIndexUuid());
            criteria.getPartition().setString(indexShardKey.getPartition().getLabel());

            final List<IndexShard> indexShards = new ArrayList<>();
            final ResultPage<IndexShard> indexShardResultPage = indexShardDao.find(criteria);
            LOGGER.debug(() -> LogUtil.message(
                    "getExistingShards(), found {} un-filtered shards, maxDocsPerShard: {}",
                    NullSafe.getOrElse(indexShardResultPage, ResultPage::size, 0),
                    maxDocsPerShard));
            for (final IndexShard indexShard : indexShardResultPage.getValues()) {
                // Look for non deleted, non-full, non-corrupt index shards.
                final IndexShardStatus status = indexShard.getStatus();
                if (status != null
                    && REQUIRED_SHARD_STATES.contains(status)
                    && indexShard.getDocumentCount() < maxDocsPerShard) {
                    indexShards.add(indexShard);
                } else {
                    LOGGER.debug(() -> LogUtil.message("Ignoring shard {} with status: {}, docCount: {}",
                            indexShard.getId(), status, indexShard.getDocumentCount()));
                }
            }
            LOGGER.debug(() -> LogUtil.message(
                    "getExistingShards(), indexShards size: {}", NullSafe.size(indexShards)));
            return indexShards;
        }
Finds existing shards for the specified key.
stroom-index/stroom-index-impl/src/main/java/stroom/index/impl/ActiveShardsCacheImpl.java