Java API Client Bulk Response Error Handling

Hi All,
While migrating from Elastic HighLevelRestClient to bnew Java API Client, we are facing issues in handling error scenarios in BulkResponse.
Earlier in HLRC, in BulkItemResponse, there was Failure type field, which contained RestStatus which is an enum of all the HTTP status codes. In Java API Client, we have BulkResponseItem, which has status(int) and result(string) fields, but there is no such mapping of all the rest statuses as earlier.
How should that be handled?

Welcome!

I guess you could reuse this class in your code I believe:

And call this method:

I'm normally just using the int value on my side. Like

if (status >= 400) { 
  // Do something
}

Does this help?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.