elastic/elasticsearch-metrics-reporter-java

Unable to connect to elasticsearch when shield plugin is used.

Closed this issue · 1 comments

I am getting the following error while connecting to elasticsearch.

Reporting returned code 401 Unauthorized: {}

I am using shield plugin with elasticsearch and how do I pass the username and password?

We should send the username and password for authentication before posting any data. The following code worked.
Authenticator.setDefault (new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("username", "password".toCharArray()); } });