public Long performAction(final FindIndexShardCriteria criteria, final IndexShardAction action) {
        return securityContext.secureResult(AppPermission.MANAGE_INDEX_SHARDS_PERMISSION, () -> {
            final String thisNodeName = nodeInfo.getThisNodeName();
            final ResultPage<IndexShard> shards = indexShardDao.find(criteria);

            // Only perform actions on shards owned by this node.
            final List<IndexShard> ownedShards = shards
                    .stream()
                    .filter(indexShard -> thisNodeName.equals(indexShard.getNodeName()))
                    .toList();
            return performAction(ownedShards, action);
        });
    }
Delete anything that has been marked to delete
stroom-index/stroom-index-impl/src/main/java/stroom/index/impl/IndexShardManager.java