-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Wrong HTTP Response code in _bulk API #17452
Comments
Found that HTTP Status is always set to Is this correct? |
@manojsm51 Batch style APIs are tricky. How do you handle the case where operations within the batch have different status codes? In any case where the request was valid and we processed individual items then the overall request status will be 200 and the result of each item will be described in the response payload, even if there is only one item or all items have the same status. This is the behavior you have described here and is correct. In cases where the batch cannot be processed at all (such as improper syntax in the request body), then you'll get a non-200 status code in the response. |
Hi @andrross , Response code 200 indicates the request is accepted though each operation within the batch did not succeed. |
From https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207:
The 207 code does not seem appropriate here.
The _bulk response body does include a top-level errors field as a convenience to determine if any of the individual operations had an error. |
Describe the bug
Hi,
I tried ingesting data using
_bulk
API to OpenSearch which has RED cluster state.It throws below
primary shard is not active
error as expected.But in HTTP response headers, it throws
200
instead of503
.Related component
Other
To Reproduce
_bulk
request to master/other available nodes (usecurl
with verbose-v
)Expected behavior
HTTP response code of
_bulk
API should reflect the original response code of each internal request. i.e.,503
in this caseAdditional Details
Plugins
None
Host/Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: