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

NewBulkIndexer never returns an error #391

Open
liamphmurphy opened this issue Dec 26, 2021 · 0 comments
Open

NewBulkIndexer never returns an error #391

liamphmurphy opened this issue Dec 26, 2021 · 0 comments

Comments

@liamphmurphy
Copy link

liamphmurphy commented Dec 26, 2021

Hi all,

I've been messing around with this library and came across that NewBulkIngestor does not seem to return an error in any case. The only place where an error could be obtained, when creating the Elastic client if it is nil, the error message is completely ignored.

I had a few thoughts;

  1. If that function is never going to return an error, the func signature should change so the user isn't expected to handle an error that will never occur
  2. I personally don't understand the reason why creating a default Elastic client is desirable if it is nil, I would expect that to be an error along the lines of "elastic client is nil" so that the user is told to handle the making of a new client. A bulk indexer init func, in my mind, should not make that decision.
  3. If the ability for the client to be made if it is nil is still desirable, then we should at least let that error from the elasticsearch.NewDefaultClient() call be returned if the function is going to declare it could return an error.

Happy to make whatever change is decided. In my opinion, we should forego the making of that default client (unless there is a use case I'm missing) and return an error in the case that cfg.Client == nil.

Thanks all for your time.

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