docs: static List<PartitionDefinition> findShardPartitions(Settings settings, MappingSet mappingSet, Map<String, NodeInfo> nodes,
                                                           List<List<Map<String, Object>>> shards, Log log) {
          Mapping resolvedMapping = mappingSet == null ? null : mappingSet.getResolvedView();
          List<PartitionDefinition> partitions = new ArrayList<PartitionDefinition>(shards.size());
          for (List<Map<String, Object>> group : shards) {
              String index = null;
              int shardId = -1;
              List<String> locationList = new ArrayList<String> ();
              for (Map<String, Object> replica : group) {
                  ShardInfo shard = new ShardInfo(replica);
                  index = shard.getIndex();
                  shardId = shard.getName();
                  if (nodes.containsKey(shard.getNode())) {
                      locationList.add(nodes.get(shard.getNode()).getPublishAddress());
                  }
              }
              if (index == null) {
                  // Could not find shards for this partition. Continue anyway?
                  if (settings.getIndexReadAllowRedStatus()) {
                      log.warn("Shard information is missing from an index and will not be reached during job execution. " +
                              "Assuming shard is unavailable and cluster is red! Continuing with read operation by " +
                              "skipping this shard! This may result in incomplete data retrieval!");
                  } else {
                      throw new IllegalStateException("Could not locate shard information for one of the read indices. " +
                              "Check your cluster status to see if it is unstable!");
                  }
              } else {
                  PartitionDefinition partition = new PartitionDefinition(settings, resolvedMapping, index, shardId,
                          locationList.toArray(new String[0]));
                  partitions.add(partition);
              }
          }
          return partitions;
      }