Java Client API to check the size of bulk queue

I see. I wish we can enhance at some point the bulk processor to slow down automatically when the cluster gets overloaded. In the same way beats and logstash are doing I think.

Anyway, I don't there is a method to access nodes stats API (I did not find it).
So here is may be a way to get that information. Note that you will have to parse the JSON response with whatever framework (Jackson?) to access the data you want to look for.

Response response = client.getLowLevelClient().performRequest(new Request("GET", "/_nodes/stats/thread_pool"));
String s = EntityUtils.toString(response.getEntity());
System.out.println("thread_pool = " + s);