Home > Software design >  Getting 400 while connnecting to Azure managed Elastic search cloud
Getting 400 while connnecting to Azure managed Elastic search cloud

Time:07-04

I deployed Azure's Elastic Search managed solution. Now I am trying to connect to it from my local machine, using Java client version 8.2.3 (tried with 8.3 as well). Below mentioned is the endpoint and ports. However, I am getting 400 response code all the times.

Endpoint : https://2029sn39n2424brUem8868ae.es.eastus2.azure.elastic-cloud.com (Sample only) Port : 9200, 9300, 9243

  • I tried adding/removing IP filter. Didn't work.
  • I created API key and added it in request header. Didn't work.

Error response : host= https://2029sn39n2424brUem8868ae.es.eastus2.azure.elastic-cloud.com response=HTTP/1.0 400 Bad Request

Can anyone please help?

CodePudding user response:

Solved the issue. The endpoint and port were incorrect.

Correct endpoint : {cluster_name}.es.{region_name}.azure.elastic-cloud.com ex : test_cluster.es.eastus.azure.elastic-cloud.com Correct port : 9243

Also, in RestClient builder constructor had to specify the protocol as https.

RestClient.builder(new HttpHost(host, port, "https"));

For anyone doing the same thing, wrote the exact steps here : https://medium.com/@udit.jindal/connecting-local-java-client-with-elastic-cloud-elasticsearch-on-cloud-on-azure-aws-c4b48b61a4cc

  • Related