olivere / elastic

Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch

Home Page:https://olivere.github.io/elastic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bulk index failures

amirEBD opened this issue · comments

Which version of Elastic are you using?

elastic.v7 (for Elasticsearch 7.9)

Hi @olivere,
I used the bulk index with bulk processor which are great together. I had an issue how to get which requests have trouble inserting/deleting? As ES mentions it'll return error on this occasions but how will olivere get my client aware of errors? Should it be on after function?

Another questoin I have is that wheter it's ok with the processor to concurrently Add(req) inside it? Is it best practice?

Bulk processor is OK if you don't have complex error handling (or even fire & forget). If you have a more complex logic, you should maybe change to do bulk indexing. Here's a recipe for that. Here's a test that uses an after function to handle errors.

Notice however that you should change your code to use the official Elasticsearch client for Go as this library is deprecated.