Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiCallDetails says Success = true, but there are items with errors #30

Open
snakefoot opened this issue Jul 16, 2021 · 0 comments
Open

Comments

@snakefoot
Copy link

snakefoot commented Jul 16, 2021

Have this BytesResponse from a bulk-operation, where Success = true:

Successful (200) low level call on POST: /_bulk
{
"took":0,
"errors":true,
"items":[{"index":{"_index":"logstash-2021.07.12","_type":"_doc","_id":"OTgmmnoBq3Eup03vE24t","status":403,"error":{"type":"security_exception","reason":"action [indices:data/write/bulk[s]] is unauthorized for API key id [NzgjmnoBq3Eup03vg25H] of user [elastic] on indices [logstash-2021.07.12], this action is granted by the index privileges [create_doc,create,delete,index,write,all]"}

Right now ApiCallDetails has these fields, when none of them tells that something failed:

Success = success,
OriginalException = exception,
HttpStatusCode = statusCode,
RequestBodyInBytes = requestData.PostData?.WrittenBytes,
Uri = requestData.Uri,
HttpMethod = requestData.Method,
DeprecationWarnings = warnings ?? Enumerable.Empty<string>(),
ResponseMimeType = mimeType,
ConnectionConfiguration = requestData.ConnectionSettings

Would like something similar to DeprecationWarnings, but where the HttpHeader signals one (or more) items failed:

responseMessage.Headers.TryGetValues("Warning", out warnings);

Maybe also use the "Warning"-part to also signal that "One ore more items with errors", when no other "deprecated warnings".

Then one can react on DeprecationWarnings being non-empty and then deserialize the entire response, to reveal the actual issue(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant