docs: private static RestRepository initAliasWrite(GetAliasesRequestBuilder.Response response, Settings settings, long currentInstance,
                                                   Resource resource, Log log) {
          if (log.isDebugEnabled()) {
              log.debug(String.format("Resource [%s] resolves as an index alias", resource));
          }
  
          // indexName -> aliasName -> alias definition
          Map<String, Map<String, IndicesAliases.Alias>> indexAliasTable = response.getIndices().getAll();
  
          if (indexAliasTable.size() < 1) {
              // Sanity check
              throw new EsHadoopIllegalArgumentException("Cannot initialize alias write resource [" + resource.index() +
                      "] if it does not have any alias entries.");
          } else if (indexAliasTable.size() > 1) {
              // Multiple indices, validate that one index-alias relation has its write index flag set
              String currentWriteIndex = null;
              for (Map.Entry<String, Map<String, IndicesAliases.Alias>> indexRow : indexAliasTable.entrySet()) {
                  String indexName = indexRow.getKey();
                  Map<String, IndicesAliases.Alias> aliases = indexRow.getValue();
                  IndicesAliases.Alias aliasInfo = aliases.get(resource.index());
                  if (aliasInfo.isWriteIndex()) {
                      currentWriteIndex = indexName;
                      break;
                  }
              }
              if (currentWriteIndex == null) {
                  throw new EsHadoopIllegalArgumentException("Attempting to write to alias [" + resource.index() + "], " +
                          "but detected multiple indices [" + indexAliasTable.size() + "] with no write index selected. " +
                          "Bailing out...");
              } else {
                  if (log.isDebugEnabled()) {
                      log.debug(String.format("Writing to currently configured write-index [%s]", currentWriteIndex));
                  }
              }
          } else {
              // Single index in the alias, but we should still not pin the nodes
              if (log.isDebugEnabled()) {
                  log.debug(String.format("Writing to the alias's single configured index [%s]", indexAliasTable.keySet().iterator().next()));
              }
          }
  
          // alias-index write - since we don't know beforehand what concrete index will be used at any
          // given time during the job, use an already selected node
          String node = SettingsUtils.getPinnedNode(settings);
          if (log.isDebugEnabled()) {
              log.debug(String.format("Partition writer instance [%s] assigned to [%s]", currentInstance, node));
          }
  
          return new RestRepository(settings);
      }