lambdaworks / zio-elasticsearch

ZIO Elasticsearch is a type-safe and streaming-friendly ZIO native Elasticsearch client.
https://lambdaworks.github.io/zio-elasticsearch/
Apache License 2.0
60 stars 18 forks source link

Change return type of executing bulk request #205

Closed jlcanela closed 1 year ago

jlcanela commented 1 year ago

A good practice with ElasticSearch when bulk insert is to verify the status for each Bulk response item so that it’s possible to retry this item associated request if necessary. Current bulk request returning Unit prevents such practice.

This PR:

jlcanela commented 1 year ago

Hey @jlcanela,

I would like to thank you for your contribution! Amazing work overall!

Besides several remarks in the code, I would like to point out that BulkResponse is a package private class, and therefore, I'm not sure it can be used from the app - you can try it in our example app.

We have private[elasticsearch] for internal Elastic responses, and our practice is to have a separate class for the library responses - you can check the result package. We should identify what is the most important info for the bulk response and define BulkResult which will be public.

Thank you for your kind remarks. I now use similar patterns to 'result' package. Don’t hesitate if you have any comment.