in flink-connector-elasticsearch7/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/table/Elasticsearch7Configuration.java [45:69]
private static HttpHost validateAndParseHostsString(String host) {
try {
HttpHost httpHost = HttpHost.create(host);
if (httpHost.getPort() < 0) {
throw new ValidationException(
String.format(
"Could not parse host '%s' in option '%s'. It should follow the format 'http://host_name:port'. Missing port.",
host, HOSTS_OPTION.key()));
}
if (httpHost.getSchemeName() == null) {
throw new ValidationException(
String.format(
"Could not parse host '%s' in option '%s'. It should follow the format 'http://host_name:port'. Missing scheme.",
host, HOSTS_OPTION.key()));
}
return httpHost;
} catch (Exception e) {
throw new ValidationException(
String.format(
"Could not parse host '%s' in option '%s'. It should follow the format 'http://host_name:port'.",
host, HOSTS_OPTION.key()),
e);
}
}