Skip to content

NewBulkIndexer never returns an error #391

@liamphmurphy

Description

@liamphmurphy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions