# Exception while using java client: ClusterBlockException\[blocked by: \[SERVICE\_UNAVAILABLE/1/state not recovered / initialized\];\]

**URL:** https://discuss.elastic.co/t/exception-while-using-java-client-clusterblockexception-blocked-by-service-unavailable-1-state-not-recovered-initialized/200855
**Category:** Elasticsearch
**Created:** [September 24, 2019, 11:45am UTC](https://discuss.elastic.co/t/exception-while-using-java-client-clusterblockexception-blocked-by-service-unavailable-1-state-not-recovered-initialized/200855 "2019-09-24T11:45:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![animesh\_sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/animesh_sharma/32/47894_2.png) [@animesh\_sharma](https://discuss.elastic.co/u/animesh_sharma)
#### Post date: [September 24, 2019, 11:45am UTC](https://discuss.elastic.co/t/exception-while-using-java-client-clusterblockexception-blocked-by-service-unavailable-1-state-not-recovered-initialized/200855/1 "2019-09-24T11:45:05Z")

</div>

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

```auto
 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
 40 
 41 # for running single node elastic search
 42 discovery.type: single-node

```

When I use the [dropwizard elasticsearch java client](https://mvnrepository.com/artifact/io.dropwizard.modules/dropwizard-elasticsearch/1.2.0-1) with below config

```auto
esConfiguration:
  clusterName: elasticsearch
  settings:
    path.home: /tmp/elasticsearch
  servers:
  - localhost:9200

```

I get the error after sending any query  
[https://pastebin.com/RFuZK1xm](https://pastebin.com/RFuZK1xm)

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

```auto
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()
  .url("http://localhost:8080/api/search/suggest")
  .post(body)
  .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")
  .build();

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

```

Can someone point out what am I doing incorrect?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 22, 2019, 11:45am UTC](https://discuss.elastic.co/t/exception-while-using-java-client-clusterblockexception-blocked-by-service-unavailable-1-state-not-recovered-initialized/200855/2 "2019-10-22T11:45:49Z")

</div>

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