-
Notifications
You must be signed in to change notification settings - Fork 727
Bulk operations reports "success" despite underlying errors in the response #208
Comments
You are right on that |
I think that would be fine, ideally it would be good to be able to easily get a List of failed doc _ids |
Well you can have multiple operations on the same doc _id, so to get over that we would need to return individual operations in a structured way. My rough idea is:
edit: If I'm not mistaken, you can actually have same operation on same id multiple times and there is no information to identify them uniquely in the response... Just a strange case to keep in mind. |
@ctrimble Currently one would do:
How would having access to http code change this check? |
I am still having trouble with clear documentation on failures in ES, but digging through the different tickets that are around, it seems like The code you posted does seem workable. It did not seem intuitive that |
It would return something meaningful only if the request was properly formatted (then evaluated by server) but some of the operations in bulk failed. If the whole request was malformed then ES returns 4XX iirc, which would go into the very last else statement in previous pseudocode. Same goes for 5XX responses. And yes at that point you would not be able to distinguish between a 4XX and a 5XX other than the information in Original concern (at least as I understood it) and my suggestions were only for distinguishing between 4XX response and (properly evaluated yet) failed operation response. I see now that is not all but there is also a need to distinguish between 4XX vs 5XX. Since the interest point in that distinction is being able to retry, I'd suggest utilising the retry strategies of the http client such as DefaultServiceUnavailableRetryStrategy (i.e.: adding and making them configurable for jest client). |
I am not sure about the details of the retry strategy, but I think that abstracting the status code from users is not the best thing. Helper methods for testing if the code is |
Update: response code is now added to result class. After thinking it over I agree with @ctrimble that if it's gonna make user's life easier there's no reason to not have this change considering no effort is required. |
Submitting various
Bulk
requests in Jest.I get a client from the client factory and call
execute()
on it with myBulk
request, I get back a JestResult and checkisSucceeded()
on it which reports true, yet when I inspect the JestResultjsonString
property I see all these errors in the result.I don't think JestResult should treat this as a successful result. If some failed and some succeeded I think there should be a way to interrogate the JestResult (via another flag) like "partial success/error" etc to hint the caller to check the raw result string...
The text was updated successfully, but these errors were encountered: