Fix bug of getting ES host error (#2342)

This commit is contained in:
令狐少侠
2019-12-01 13:06:32 +08:00
committed by ZHAO Chun
parent 6fbb5b31fa
commit 725468f8a2

View File

@ -110,6 +110,11 @@ public class EsRestClient {
// maybe should add HTTP schema to the address
// actually, at this time we can only process http protocol
// NOTE. currentNode may have some spaces.
// User may set a config like described below:
// hosts: "http://192.168.0.1:8200, http://192.168.0.2:8200"
// then currentNode will be "http://192.168.0.1:8200", " http://192.168.0.2:8200"
currentNode = currentNode.trim();
if (!(currentNode.startsWith("http://") || currentNode.startsWith("https://"))) {
currentNode = "http://" + currentNode;
}