This exception occurs because the documentIds collection is empty .
You should check if your collection (list, queue, etc.) has documents before executing the request. I faced the same problem yesterday, in my case, inserts with elastic search happen in a given interval (say, 5 s), and not that the insert collection was not empty;
In my case, this is a very rare occurrence, and it will rarely be rare (in my case, 3 million documents inserted every day), and it can be difficult to identify before moving on to production.
I would handle your exceptions as follows:
if(!documentIds.isEmpty()) { BulkRequestBuilder bulkRequestBuilder = client.prepareBulk(); for (String documentId : documentIds) { bulkRequestBuilder.add(client.prepareUpdate("39302", "3", documentId).setScript("ctx._source.customerName=\"Ramaraj\";")); } BulkResponse bulkResponse = bulkRequestBuilder.execute().actionGet(); }
source share