skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. Just to clarify a little bit more your answer, the host should be just the hostname without "http" or "https" at the beginning. That worked for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search