-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add parsing method to bulk response #23234
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
Add parsing method to bulk response #23234
Conversation
This commit adds the `fromXContent()` parsing method to BulkResponse.
f9042ea to
a570fd3
Compare
|
This is ready to review. |
javanna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| XContentParser.Token token = parser.nextToken(); | ||
| ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation); | ||
|
|
||
| long took = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shall we initialize it to -1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be aligned with ingest took millis.
| } else if (INGEST_TOOK.equals(currentFieldName)) { | ||
| ingestTook = parser.longValue(); | ||
| } else if (ERRORS.equals(currentFieldName) == false) { | ||
| throwUnknownField(currentFieldName, parser.getTokenLocation()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't parse errors as we don't have a field for it in the response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, errors is the output of the BulkResponse.hasFailures() method which simply iterates over bulk item and checks for failed item.
|
Thanks @javanna ! |
This commit adds the `fromXContent()` parsing method to BulkResponse.
This pull request adds the
fromXContent()parsing method to BulkResponse.