You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose a usability change in BulkFailureException class.
The class provides information on failed documents in form of Map {document._id->BulkResponseItem.reason}:
`public class BulkFailureException extends DataRetrievalFailureException {
private final Map<String, String> failedDocuments;
public BulkFailureException(String msg, Map<String, String> failedDocuments) {
super(msg);
this.failedDocuments = failedDocuments;
}
public Map<String, String> getFailedDocuments() {
return failedDocuments;
}
}`
The problem is that the reason is a string and it is problematic to reason about it when your client code needs to handle those failures in a specific way.
For instance in my project I need to have special handling of conflicts (when an attempt was done to save a document with the same or lower version, HTTP status 409) and currently I have to rely on string message from native elasticsearch library (which could change in the future btw)
It would be great to have the integer status of a particular failure.
Not to introduce a breaking change, I would imaging a new Map to be added as:
`public class BulkFailureException extends DataRetrievalFailureException {
private final Map<String, String> failedDocuments;
private final Map<String, Integer> failedDocumentStatuses;
Hi,
I would like to propose a usability change in BulkFailureException class.
The class provides information on failed documents in form of Map {document._id->
BulkResponseItem.reason
}:`public class BulkFailureException extends DataRetrievalFailureException {
private final Map<String, String> failedDocuments;
}`
The problem is that the
reason
is a string and it is problematic to reason about it when your client code needs to handle those failures in a specific way.For instance in my project I need to have special handling of conflicts (when an attempt was done to save a document with the same or lower version, HTTP status 409) and currently I have to rely on string message from native elasticsearch library (which could change in the future btw)
It would be great to have the integer
status
of a particular failure.Not to introduce a breaking change, I would imaging a new Map to be added as:
`public class BulkFailureException extends DataRetrievalFailureException {
private final Map<String, String> failedDocuments;
private final Map<String, Integer> failedDocumentStatuses;
}`
I could submit a PR if the above makes sense.
Thanks.
The text was updated successfully, but these errors were encountered: