Propagating Elasticsearch exceptions to Elasticsearch.Nest client

I am new to Elasticsearch and I've run into OOM exception several times
during bulk indexing. Since then I've taken measures like increasing heap
size and throttling bulk indexing rate but I would like to reliably know
when Java runs out of memory and how to recover from that situation.
Elasticsearch logs the OOM errors to a log file but I could not find an
easy way to get the client to know about it.

Ask:

  1. What is the best place to handle Elasticsearch OOM exceptions - Client
    or Server?
  2. Once it runs out of memory and gets detected reliably, what is the best
    way to revive Elasticsearch without data loss?

I am using Elasticsearch.Nest client to talk to Elasticsearch. I am open to
using other clients too if it helps my cause.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e2dd96c4-120c-40d5-b4a3-59ca1c099f1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.