Exception while using java client: ClusterBlockException[blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];]

I have a single-node elastic search instance running locally.
I am able to create/delete index along with inserting / searching index into it works through curl / postman.
My elastic-search,yml config

 33 path.data: /var/lib/elasticsearch
 34 #
 35 # Path to log files:
 36 #
 37 path.logs: /var/log/elasticsearch
 38 #
 39 path.home: /tmp/elasticsearch
 41 # for running single node elastic search
 42 discovery.type: single-node

When I use the dropwizard elasticsearch java client with below config

  clusterName: elasticsearch
    path.home: /tmp/elasticsearch
  - localhost:9200

I get the error after sending any query

When I try directly calling the API with Java OkHTTPClient it works fine

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"searchWord\" : \"aka\"\n}");
Request request = new Request.Builder()
  .addHeader("Content-Type", "application/json")
  .addHeader("User-Agent", "PostmanRuntime/7.17.1")
  .addHeader("Accept", "*/*")
  .addHeader("Cache-Control", "no-cache")
  .addHeader("Postman-Token", "38ca2297-b5cc-4e58-9c02-asdcdsc6e2bae6,0f777d69-00cb-4ac5-9ebf-f73ed161f9ce")
  .addHeader("Host", "localhost:8080")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Length", "31")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")

Response response = client.newCall(request).execute();

Can someone point out what am I doing incorrect?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.