elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
705 stars 72 forks source link

[ENHANCEMENT] Support clone for BulkOperation and similar structs #195

Closed oeed closed 1 month ago

oeed commented 2 years ago

Is your feature request related to a problem? Please describe. I am needing to implement retry logic for my requests as we're very occasionally encountering 502s on AWS. For most requests this can be done fairly easily, as .body() can take a borrowed value.

However, Bulk requests require taking ownership of the Vec<BulkOperation<..>>, and additionally BulkOperation doesn't implement clone – so the only way around this is to make your own bulk operation struct that can be cloned then converted.

Describe the solution you'd like There are a few possible solutions of varying complexity and effort required:

I'd happily provide a PR for the last two, although the first is certainly a far more complex solution that mightn't be desired.

swallez commented 1 month ago

Fixed in PR #202