Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Get index on error with Writable bulk #23

Open
KoalaMoala opened this issue Mar 4, 2019 · 0 comments
Open

[Enhancement] Get index on error with Writable bulk #23

KoalaMoala opened this issue Mar 4, 2019 · 0 comments

Comments

@KoalaMoala
Copy link

KoalaMoala commented Mar 4, 2019

Hello there,

I have been using elasticsearch-streams in production for several month and I'm pretty happy with it. However I think I could have an easier time debugging.

I would like to get the index of the error back in the error object. Something like this :

for (var i = 0; i < resp.items.length; i++) {
       var bulkItemResp = resp.items[i];
       var key = Object.keys(bulkItemResp)[0];
        if (bulkItemResp[key].error) {
          var err = new Error(bulkItemResp[key].error.reason || bulkItemResp[key].error);
          err.reason = bulkItemResp[key].error.reason;
          err.type = bulkItemResp[key].error.type;
          err.index = i; // <<< this
          self.emit('error', err);
        }
}

https://github.com/hmalphettes/elasticsearch-streams/blob/master/lib/writable-bulk.js#L88

It would be really helpful to know which object is the source of the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant