docs: private ElasticSearchSetup.Connection legacyConfiguration(Configuration config) {
          Node node;
          Client client;
  
          if (config.get(LOCAL_MODE)) {
  
              log.debug("Configuring ES for JVM local transport");
  
              boolean clientOnly = config.get(CLIENT_ONLY);
              boolean local = config.get(LOCAL_MODE);
  
              NodeBuilder builder = NodeBuilder.nodeBuilder();
              Preconditions.checkArgument(config.has(INDEX_CONF_FILE) || config.has(INDEX_DIRECTORY),
                      "Must either configure configuration file or base directory");
              if (config.has(INDEX_CONF_FILE)) {
                  String configFile = config.get(INDEX_CONF_FILE);
                  ImmutableSettings.Builder sb = ImmutableSettings.settingsBuilder();
                  log.debug("Configuring ES from YML file [{}]", configFile);
                  FileInputStream fis = null;
                  try {
                      fis = new FileInputStream(configFile);
                      sb.loadFromStream(configFile, fis);
                      builder.settings(sb.build());
                  } catch (FileNotFoundException e) {
                      throw new TitanException(e);
                  } finally {
                      IOUtils.closeQuietly(fis);
                  }
              } else {
                  String dataDirectory = config.get(INDEX_DIRECTORY);
                  log.debug("Configuring ES with data directory [{}]", dataDirectory);
                  File f = new File(dataDirectory);
                  if (!f.exists()) f.mkdirs();
                  ImmutableSettings.Builder b = ImmutableSettings.settingsBuilder();
                  for (String sub : DATA_SUBDIRS) {
                      String subdir = dataDirectory + File.separator + sub;
                      f = new File(subdir);
                      if (!f.exists()) f.mkdirs();
                      b.put("path." + sub, subdir);
                  }
                  b.put("script.disable_dynamic", false);
                  b.put("indices.ttl.interval", "5s");
  
                  builder.settings(b.build());
  
                  String clustername = config.get(CLUSTER_NAME);
                  Preconditions.checkArgument(StringUtils.isNotBlank(clustername), "Invalid cluster name: %s", clustername);
                  builder.clusterName(clustername);
              }
  
              node = builder.client(clientOnly).data(!clientOnly).local(local).node();
              client = node.client();
  
          } else {
              log.debug("Configuring ES for network transport");
              ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
              if (config.has(CLUSTER_NAME)) {
                  String clustername = config.get(CLUSTER_NAME);
                  Preconditions.checkArgument(StringUtils.isNotBlank(clustername), "Invalid cluster name: %s", clustername);
                  settings.put("cluster.name", clustername);
              } else {
                  settings.put("client.transport.ignore_cluster_name", true);
              }
              log.debug("Transport sniffing enabled: {}", config.get(CLIENT_SNIFF));
              settings.put("client.transport.sniff", config.get(CLIENT_SNIFF));
              settings.put("script.disable_dynamic", false);
              TransportClient tc = new TransportClient(settings.build());
              int defaultPort = config.has(INDEX_PORT)?config.get(INDEX_PORT):HOST_PORT_DEFAULT;
              for (String host : config.get(INDEX_HOSTS)) {
                  String[] hostparts = host.split(":");
                  String hostname = hostparts[0];
                  int hostport = defaultPort;
                  if (hostparts.length == 2) hostport = Integer.parseInt(hostparts[1]);
                  log.info("Configured remote host: {} : {}", hostname, hostport);
                  tc.addTransportAddress(new InetSocketTransportAddress(hostname, hostport));
              }
              client = tc;
              node = null;
          }
  
          return new ElasticSearchSetup.Connection(node, client);
      }