Skip to content

Commit

Permalink
execute item failure callback execution on bulk request error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kellen Miller committed Oct 2, 2024
1 parent 5bd097a commit 7c051c5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions opensearchutil/bulk_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,7 @@ func (w *worker) flush(ctx context.Context) error {

blk, err = w.bi.config.Client.Bulk(ctx, req)
if err != nil {
if err != nil {
return w.handleBulkError(ctx, fmt.Errorf("flush: %w", err))
}
return w.handleBulkError(ctx, fmt.Errorf("flush: %w", err))
}

for i, blkItem := range blk.Items {
Expand All @@ -518,7 +516,7 @@ func (w *worker) flush(ctx context.Context) error {
item = w.items[i]
// The OpenSearch bulk response contains an array of maps like this:
// [ { "index": { ... } }, { "create": { ... } }, ... ]
// We range over the map, to set the first key and value as "op" and "info".
// We range over the map, to set the last key and value as "op" and "info".
for k, v := range blkItem {
op = k
info = v
Expand Down

0 comments on commit 7c051c5

Please sign in to comment.