Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/elastic/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ For more details see the [`responses`][responses-mod] module.

[tokio]: https://tokio.rs

[endpoints-mod]: requests/endpoints/index.html
[endpoints-mod]: ../endpoints/index.html
[RequestParams]: struct.RequestParams.html
[SyncClient]: type.SyncClient.html
[SyncClientBuilder]: struct.SyncClientBuilder.html
Expand Down Expand Up @@ -517,20 +517,20 @@ For more details see the [`responses`][responses-mod] module.
[RequestBuilder]: requests/struct.RequestBuilder.html
[RequestBuilder.params]: requests/struct.RequestBuilder.html#method.params
[RawRequestBuilder]: requests/type.RawRequestBuilder.html
[SearchRequest]: requests/endpoints/struct.SearchRequest.html
[SqlQueryRequest]: requests/endpoints/struct.SqlQueryRequest.html
[BulkRequest]: requests/endpoints/struct.BulkRequest.html
[GetRequest]: requests/endpoints/struct.GetRequest.html
[UpdateRequest]: requests/endpoints/struct.UpdateRequest.html
[DeleteRequest]: requests/endpoints/struct.DeleteRequest.html
[IndexRequest]: requests/endpoints/struct.IndexRequest.html
[IndicesPutMappingRequest]: requests/endpoints/struct.IndicesPutMappingRequest.html
[IndicesCreateRequest]: requests/endpoints/struct.IndicesCreateRequest.html
[IndicesOpenRequest]: requests/endpoints/struct.IndicesOpenRequest.html
[IndicesCloseRequest]: requests/endpoints/struct.IndicesCloseRequest.html
[IndicesDeleteRequest]: requests/endpoints/struct.IndicesDeleteRequest.html
[IndicesExistsRequest]: requests/endpoints/struct.IndicesExistsRequest.html
[PingRequest]: requests/endpoints/struct.PingRequest.html
[SearchRequest]: ../endpoints/struct.SearchRequest.html
[SqlQueryRequest]: ../endpoints/struct.SqlQueryRequest.html
[BulkRequest]: ../endpoints/struct.BulkRequest.html
[GetRequest]: ../endpoints/struct.GetRequest.html
[UpdateRequest]: ../endpoints/struct.UpdateRequest.html
[DeleteRequest]: ../endpoints/struct.DeleteRequest.html
[IndexRequest]: ../endpoints/struct.IndexRequest.html
[IndicesPutMappingRequest]: ../endpoints/struct.IndicesPutMappingRequest.html
[IndicesCreateRequest]: ../endpoints/struct.IndicesCreateRequest.html
[IndicesOpenRequest]: ../endpoints/struct.IndicesOpenRequest.html
[IndicesCloseRequest]: ../endpoints/struct.IndicesCloseRequest.html
[IndicesDeleteRequest]: ../endpoints/struct.IndicesDeleteRequest.html
[IndicesExistsRequest]: ../endpoints/struct.IndicesExistsRequest.html
[PingRequest]: ../endpoints/struct.PingRequest.html

[responses-mod]: responses/index.html
[SyncResponseBuilder]: ../http/receiver/struct.SyncResponseBuilder.html
Expand Down
4 changes: 2 additions & 2 deletions src/elastic/src/client/requests/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ where
# }
```

[Endpoint]: requests/struct.Endpoint.html
[Endpoint]: ../endpoints/struct.Endpoint.html
[RawRequestBuilder]: requests/raw/type.RawRequestBuilder.html
[endpoints-mod]: requests/endpoints/index.html
[endpoints-mod]: ../endpoints/index.html
*/
pub fn request<TEndpoint, TBody>(
&self,
Expand Down
23 changes: 13 additions & 10 deletions src/elastic/src/client/responses/bulk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ Send a bulk request and iterate through the errors:
```no_run
# use elastic::prelude::*;
# use elastic::client::responses::bulk::Action;
# fn do_request() -> BulkErrorsResponse { unimplemented!() }
# fn main() {
let response: BulkErrorsResponse = do_request();
# fn main() -> Result<(), elastic::Error>{
# let client = SyncClientBuilder::new().build()?;
let response: BulkErrorsResponse = client.bulk().errors_only().send()?;

// Do something with failed items
for item in response {
Expand All @@ -273,16 +273,17 @@ for item in response {
_ => println!("err: {:?}", item)
}
}
# Ok(())
# }
```

Use `iter` to iterate over individual errors without taking ownership of them:

```no_run
# use elastic::prelude::*;
# fn do_request() -> BulkErrorsResponse { unimplemented!() }
# fn main() {
let response: BulkErrorsResponse = do_request();
# fn main() -> Result<(), elastic::Error>{
# let client = SyncClientBuilder::new().build()?;
let response: BulkErrorsResponse = client.bulk().errors_only().send()?;

// Do something with errors for index `myindex`
let item_iter = response.iter()
Expand All @@ -291,6 +292,7 @@ let item_iter = response.iter()
for item in item_iter {
println!("err: {:?}", item);
}
# Ok(())
# }
```

Expand Down Expand Up @@ -370,7 +372,7 @@ impl<TIndex, TType, TId> BulkErrorsResponse<TIndex, TType, TId> {
!self.errors
}

/** Returns `true` if any bulk itemss failed. */
/** Returns `true` if any bulk items failed. */
pub fn is_err(&self) -> bool {
self.errors
}
Expand All @@ -386,15 +388,16 @@ impl<TIndex, TType, TId> BulkErrorsResponse<TIndex, TType, TId> {

```no_run
# use elastic::prelude::*;
# fn do_request() -> BulkErrorsResponse { unimplemented!() }
# fn main() {
let response: BulkErrorsResponse = do_request();
# fn main() -> Result<(), elastic::Error> {
# let client = SyncClientBuilder::new().build()?;
let response: BulkErrorsResponse = client.bulk().errors_only().send()?;

// Iterate through all items
for item in response.iter() {
// Do something with failed items
println!("err: {:?}", item)
}
# Ok(())
# }
```
*/
Expand Down