Java application using BulkProcessing hangs if elasticsearch hangs

If there is an error, the semaphore is released. The semaphore is not released only if the callback passed to client.bulk() is never invoked, with success or failure result.

I agree the cluster should be fixed. Sending the metric data is a non functional aspect of an application. Working of your application/API is more important than the metric data itself. I would not mind some metric data getting dropped if the elasticsearch is not responding (Bulk request not succeeding within a timeout). But it should not affect the application functionality itself.

Thanks,
Paul