EsRejectedExecution Exception

Hi @Sai_Birada,

With this never bulk indexing queue should fill up more than 50 right?

No. This can still happen. For the reasons see my answer in the topic Threadpool/ Queue size limitation unsolved. In that response I also suggest concrete mitigation techniques.

With your approach you basically busy wait (Thread.yield() is usually implemented a no-op in the JVM and even if it weren't, you wouldn't wait) until the queue is below 40 items. Apart from repeatedly checking the nodes stats (additional effort for ES), you also have a race as two threads can concurrently observe a queue size of less than 40 items and submit a bulk.

Daniel