I'm trying to connect to an elasticsearch instance which is behind a ssh tunnel. Domain of the elasticsearch instance is *.ap-south-1.es.amazonaws.com
while locally on the tunnel, I connect via localhost:9201
.
Here is the code I'm using to connect to elasticsearch
RestHighLevelClient(RestClient.builder(HttpHost("localhost", 9201, "https")))
I'm getting the following error
javax.net.ssl.SSLPeerUnverifiedException: Host name 'localhost' does not match the certificate subject provided by the peer (CN=*.ap-south-1.es.amazonaws.com)
I got this error when I was working with PHP-Elasticsearch and I fixed it using
$esClient->setSSLVerification(false);
I was hoping to find a similar method for Java RestClient.