docs: public static ClusterInfo discoverClusterInfo(Settings settings, Log log) {
          ClusterName remoteClusterName = null;
          EsMajorVersion remoteVersion = null;
          String clusterName = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_NAME);
          String clusterUUID = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_CLUSTER_UUID);
          String version = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_VERSION);
          if (StringUtils.hasText(clusterName) && StringUtils.hasText(version)) { // UUID is optional for now
              if (log.isDebugEnabled()) {
                  log.debug(String.format("Elasticsearch cluster [NAME:%s][UUID:%s][VERSION:%s] already present in configuration; skipping discovery",
                          clusterName, clusterUUID, version));
              }
              remoteClusterName = new ClusterName(clusterName, clusterUUID);
              remoteVersion = EsMajorVersion.parse(version);
              return new ClusterInfo(remoteClusterName, remoteVersion);
          }
  
          RestClient bootstrap = new RestClient(settings);
          // first get ES main action info
          try {
              ClusterInfo mainInfo = bootstrap.mainInfo();
              if (log.isDebugEnabled()) {
                  log.debug(String.format("Discovered Elasticsearch cluster [%s/%s], version [%s]",
                          mainInfo.getClusterName().getName(),
                          mainInfo.getClusterName().getUUID(),
                          mainInfo.getMajorVersion()));
              }
              settings.setInternalClusterInfo(mainInfo);
              return mainInfo;
          } catch (EsHadoopException ex) {
              throw new EsHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
                      + "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
                      + "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.ES_NODES_WAN_ONLY), ex);
          } finally {
              bootstrap.close();
          }
      }