Ensure ES endpoint without http prefix can work (#2303)

This commit is contained in:
Yunfeng,Wu
2019-11-26 22:52:10 +08:00
committed by Mingyu Chen
parent 569d0bb3af
commit ccbd65daeb

View File

@ -107,6 +107,13 @@ public class EsRestClient {
if (!Strings.isEmpty(basicAuth)) {
builder.addHeader("Authorization", basicAuth);
}
// maybe should add HTTP schema to the address
// actually, at this time we can only process http protocol
if (!(currentNode.startsWith("http://") || currentNode.startsWith("https://"))) {
currentNode = "http://" + currentNode;
}
Request request = builder.get()
.url(currentNode + "/" + path)
.build();