pub struct BulkReport {
pub took: u64,
pub errors: bool,
pub items: Vec<BulkItem>,
}Expand description
What a bulk request did, item by item.
The request’s HTTP status is 200 whether every item succeeded or none did.
BulkReport::failed and BulkReport::failures are the only honest
account of what happened.
Fields§
§took: u64Milliseconds the cluster spent.
errors: boolThe cluster’s own summary: true if any item failed.
items: Vec<BulkItem>One entry per operation sent, in the order they were sent.
Implementations§
Source§impl BulkReport
impl BulkReport
Sourcepub fn all_succeeded(&self) -> bool
pub fn all_succeeded(&self) -> bool
Whether every item was written.
pub fn succeeded(&self) -> usize
pub fn failed(&self) -> usize
Sourcepub fn failed_positions(&self) -> Vec<usize>
pub fn failed_positions(&self) -> Vec<usize>
The positions in the operation list that failed.
The cluster answers in the order it was asked, so these index straight back into the slice that was sent — which is what makes resubmitting only the failures possible without matching on ids, and works for the auto-generated ids where there is nothing to match on.
Sourcepub fn retryable_positions(&self) -> Vec<usize>
pub fn retryable_positions(&self) -> Vec<usize>
The failures that a later attempt could fix — a rejected write under load, not a document that does not fit the mapping.
Resubmitting these and only these is the correct response to a bulk load that partly failed; resubmitting everything would either duplicate documents or re-attempt work that cannot succeed.
Sourcepub fn ok_or_error(&self) -> Result<()>
pub fn ok_or_error(&self) -> Result<()>
Turn any partial failure into an error.
For the caller who wants ? to notice rather than inspecting items.
The report is still there in full on the success path.