Skip to content

Change BulkIndexerConfig to improve comptability with both Client and TypedClientΒ #653

@ludovic-franconieri

Description

@ludovic-franconieri

Hello,

The BulkIndexerConfig ask for a Client *elasticsearch.Client

// BulkIndexerConfig represents configuration of the indexer.
type BulkIndexerConfig struct {
...
	Client      *elasticsearch.Client   // The Elasticsearch client.
...
}

Even though it only use the transport part :

func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, error)

So, if you use a TypedClient, you can't use it in BulkIndexerConfig, you will have to instantiate a Client only for the BulkIndexerConfig.

What I propose is to change the BulkIndexerConfig to ask for a Transport so it can be compatible with both Client and TypedClient

// BulkIndexerConfig represents configuration of the indexer.
type BulkIndexerConfig struct {
...
	Transport   esapi.Transport         // The Elasticsearch transport.
...

If you want, I already push the changes in a branch => https://github.com/ludovic-franconieri/go-elasticsearch/tree/bulk_indexer_transport

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions