asereda-gs commented on a change in pull request #1447: Calcite-3335: Getting 
new parameter from model to set it in HTTP host…
URL: https://github.com/apache/calcite/pull/1447#discussion_r322478764
 
 

 ##########
 File path: 
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
 ##########
 @@ -89,6 +101,25 @@ private static RestClient connect(Map<String, Integer> 
coordinates) {
     return RestClient.builder(set.toArray(new HttpHost[0])).build();
   }
 
+  /**
+   * Builds elastic rest client from user configuration
+   * @param hosts list of {@code scheme://hostname/port} to connect to
+   * @return newly initialized low-level rest http client for ES
+   */
+  private static RestClient connect(List<String> hosts) throws 
MalformedURLException {
+    Objects.requireNonNull(hosts, "hosts");
+    Preconditions.checkArgument(!hosts.isEmpty(), "no ES hosts specified");
+    final Set<HttpHost> set = new LinkedHashSet<>();
+
+    for (String host: hosts) {
+      URL hostURL = new URL(host);
 
 Review comment:
   Don't use URL rather 
[HttpHost.create()](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpHost.html#create(java.lang.String))

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to