wuyunfeng commented on a change in pull request #5325: URL: https://github.com/apache/incubator-doris/pull/5325#discussion_r592102526
########## File path: docs/en/extending-doris/doris-on-es.md ########## @@ -328,6 +328,63 @@ This term does not match any term in the dictionary,and will not return any re The type of `k4.keyword` is `keyword`, and writing data into ES is a complete term, so it can be matched +### Enable ES node discovery(es\_nodes\_discovery=true) + +``` +CREATE EXTERNAL TABLE `test` ( + `k1` bigint(20) COMMENT "", + `k2` datetime COMMENT "", + `k3` varchar(20) COMMENT "", + `k4` varchar(100) COMMENT "", + `k5` float COMMENT "" +) ENGINE=ELASTICSEARCH +PROPERTIES ( +"hosts" = "http://192.168.0.1:8200,http://192.168.0.2:8200", +"index" = "test”, +"type" = "doc", +"user" = "root", +"password" = "root", + +"es_nodes_discovery" = "true" +); +``` + +Parameter Description: + +Parameter | Description +---|--- +**es\_nodes\_discovery** | Whether or not to enable ES node discovery. the default is true + +When enabled, Doris will find all available nodes from ES. If you only want Doris to access some nodes, you can turn this configuration off + +### Use SSL authentication(es\_net\_ssl=true) + +``` +CREATE EXTERNAL TABLE `test` ( + `k1` bigint(20) COMMENT "", + `k2` datetime COMMENT "", + `k3` varchar(20) COMMENT "", + `k4` varchar(100) COMMENT "", + `k5` float COMMENT "" +) ENGINE=ELASTICSEARCH +PROPERTIES ( +"hosts" = "http://192.168.0.1:8200,http://192.168.0.2:8200", +"index" = "test”, +"type" = "doc", +"user" = "root", +"password" = "root", + +"es_net_ssl" = "true" Review comment: ```suggestion "http_ssl_enabled" = "true" ``` If we provide CA in future, we can use : ``` "http_ssl_key" = xxx "http_ssl_certificate" = path/to/cert ``` ########## File path: docs/en/extending-doris/doris-on-es.md ########## @@ -328,6 +328,63 @@ This term does not match any term in the dictionary,and will not return any re The type of `k4.keyword` is `keyword`, and writing data into ES is a complete term, so it can be matched +### Enable ES node discovery(es\_nodes\_discovery=true) + +``` +CREATE EXTERNAL TABLE `test` ( + `k1` bigint(20) COMMENT "", + `k2` datetime COMMENT "", + `k3` varchar(20) COMMENT "", + `k4` varchar(100) COMMENT "", + `k5` float COMMENT "" +) ENGINE=ELASTICSEARCH +PROPERTIES ( +"hosts" = "http://192.168.0.1:8200,http://192.168.0.2:8200", +"index" = "test”, +"type" = "doc", +"user" = "root", +"password" = "root", + +"es_nodes_discovery" = "true" Review comment: ```suggestion "nodes_discovery" = "true" ``` `nodes_discovery ` is already ok ########## File path: fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsNodeInfo.java ########## @@ -66,7 +71,7 @@ public EsNodeInfo(String id, Map<String, Object> map) throws DorisEsException { String address = (String) httpMap.get("publish_address"); if (address != null) { String[] scratch = address.split(":"); - this.publishAddress = new TNetworkAddress(scratch[0], Integer.valueOf(scratch[1])); + this.publishAddress = new TNetworkAddress((useSslClient ? "https://" : "") + scratch[0], Integer.parseInt(scratch[1])); Review comment: Actually I don’t want to replace here, can you consider a unified replacement in the `subphrase`? ########## File path: fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java ########## @@ -48,23 +57,33 @@ mapper.configure(SerializationConfig.Feature.USE_ANNOTATIONS, false); } - private static OkHttpClient networkClient = new OkHttpClient.Builder() - .readTimeout(10, TimeUnit.SECONDS) - .build(); + private static OkHttpClient networkClient; + + private static OkHttpClient sslNetworkClient; private Request.Builder builder; private String[] nodes; private String currentNode; private int currentNodeIndex = 0; + private boolean useSslClient; - public EsRestClient(String[] nodes, String authUser, String authPassword) { + public EsRestClient(String[] nodes, String authUser, String authPassword, boolean useSslClient) { this.nodes = nodes; this.builder = new Request.Builder(); if (!Strings.isEmpty(authUser) && !Strings.isEmpty(authPassword)) { this.builder.addHeader(HttpHeaders.AUTHORIZATION, Credentials.basic(authUser, authPassword)); } this.currentNode = nodes[currentNodeIndex]; + this.useSslClient = useSslClient; + sslNetworkClient = new OkHttpClient.Builder() Review comment: Maybe you can lazy init this ssl client. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org