I am sending requests to Elasticsearch over HTTP from a Java client using Jest. Since my requests must traverse the public Internet, I am using an Nginx proxy in front of Elasticsearch to provide SSL and HTTP Basic Auth. However, I don't see a way to set HTTP Basic Auth credentials with Jest.
Is it possible to use HTTP Basic Auth with Jest? If so how?
HTTP basic auth can be sent as a header.
String authHeader = "Basic " + new String(Base64.encodeBase64(String.format("%s:%s", username, password).getBytes()));
Index index = new Index.Builder(json)
.index(indexName)
.type(type)
.id(id)
.setHeader("Authorization", authHeader)
.build();
JestResult result = client.execute(index);