Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
ClusterBlockException cannot be caught for bulk request when using node client #7086
When the cluster is in the ClusterBlockException state (Eg. not enough master to meet min master nodes), the ClusterBlockException cannot be caught for a bulk request when using node client:
BulkRequestBuilder brb = client.prepareBulk(); XContentBuilder builder = XContentFactory.jsonBuilder().startObject().field("bfield1", "bvalue1").endObject(); String jsonString = builder.string(); IndexRequestBuilder irb = client.prepareIndex(INDEX_NAME,TYPE_NAME,"b1"); irb.setSource(jsonString); brb.add(irb); BulkResponse bulkResponse = brb.execute().actionGet();
Returns the exception:
The above cannot be caught in a catch(ClusterBlockException exception) clause. However, when the cluster is in the same state using the node client, the ClusterBlockException can be caught for search requests.