[−][src]Struct elastic_responses::bulk::BulkErrorsResponse
Response for a bulk request.
This type only accumulates bulk items that failed.
It can be more efficient if you only care about errors.
Individual bulk items are ErrorItem
and can be iterated over.
Examples
Send a bulk request and iterate through the errors:
let response: BulkErrorsResponse = do_request(); // Do something with failed items for item in response { match item.action() { Action::Delete => (), // Ignore failed deletes _ => println!("err: {:?}", item) } }
Use iter
to iterate over individual errors without taking ownership of them:
let response: BulkErrorsResponse = do_request(); // Do something with errors for index `myindex` let item_iter = response.iter() .filter(|o| o.index() == "myindex"); for item in item_iter { println!("err: {:?}", item); }
Taking BulkErrorsResponse
as an argument
The BulkErrorsResponse
type has three default generic parameters for the index, type and id fields.
If you need to accept a BulkErrorsResponse
as a function argument, you should specify these generics.
Otherwise the function will only accept a default BulkErrorsResponse
:
// Do: Supports any BulkErrorsResponse fn takes_any_response<TIndex, TType, TId>(res: BulkErrorsResponse<TIndex, TType, TId>) { } // Don't: Only supports default BulkErrorsResponse fn takes_default_response(res: BulkErrorsResponse) { }
Methods
impl<TIndex, TType, TId> BulkErrorsResponse<TIndex, TType, TId>
[src]
pub fn took(&self) -> u64
[src]
Time in milliseconds it took for Elasticsearch to process the request.
pub fn is_ok(&self) -> bool
[src]
Returns true
if all bulk items succeeded.
pub fn is_err(&self) -> bool
[src]
Returns true
if any bulk itemss failed.
ⓘImportant traits for ErrorIter<'a, TIndex, TType, TId>pub fn iter(&self) -> ErrorIter<TIndex, TType, TId>
[src]
Iterate through the bulk item errors.
Items in this iterator all all errors that occurred while handling the bulk request.
Examples
Iterate through the individual items in a BulkErrorsResponse
:
let response: BulkErrorsResponse = do_request(); // Iterate through all items for item in response.iter() { // Do something with failed items println!("err: {:?}", item) }
Trait Implementations
impl<TIndex, TType, TId> IsOkOnSuccess for BulkErrorsResponse<TIndex, TType, TId>
[src]
impl<TIndex: Clone, TType: Clone, TId: Clone> Clone for BulkErrorsResponse<TIndex, TType, TId>
[src]
fn clone(&self) -> BulkErrorsResponse<TIndex, TType, TId>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<TIndex, TType, TId> IntoIterator for BulkErrorsResponse<TIndex, TType, TId>
[src]
type Item = <Self::IntoIter as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = ErrorIntoIter<TIndex, TType, TId>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<TIndex: Debug, TType: Debug, TId: Debug> Debug for BulkErrorsResponse<TIndex, TType, TId>
[src]
impl<'de, TIndex, TType, TId> Deserialize<'de> for BulkErrorsResponse<TIndex, TType, TId> where
TIndex: Deserialize<'de>,
TType: Deserialize<'de>,
TId: Deserialize<'de>,
[src]
TIndex: Deserialize<'de>,
TType: Deserialize<'de>,
TId: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<TIndex, TType, TId> Send for BulkErrorsResponse<TIndex, TType, TId> where
TId: Send,
TIndex: Send,
TType: Send,
TId: Send,
TIndex: Send,
TType: Send,
impl<TIndex, TType, TId> Sync for BulkErrorsResponse<TIndex, TType, TId> where
TId: Sync,
TIndex: Sync,
TType: Sync,
TId: Sync,
TIndex: Sync,
TType: Sync,
Blanket Implementations
impl<T> IsOk for T where
T: IsOkOnSuccess,
[src]
T: IsOkOnSuccess,
fn is_ok<B>(
HttpResponseHead,
Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseError> where
B: ResponseBody,
[src]
HttpResponseHead,
Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseError> where
B: ResponseBody,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,