go-elasticsearch icon indicating copy to clipboard operation
go-elasticsearch copied to clipboard

Use a pointer for BaseClient.productCheckMu

Open arp242 opened this issue 1 year ago • 1 comments
trafficstars

I would like to convert a TypedClient to a regular Client; my main use-case for this is so I can use it for the bulk indexer.

Converting a TypedClient to Client is fairly straight-forward:

func ToClient(tc *elasticsearch.TypedClient) *elasticsearch.Client {
	c := &elasticsearch.Client{
		BaseClient: tc.BaseClient,
	}
	c.API = esapi.New(c)
	return c
}

Which works, but also gives an error on go vet;

literal copies lock value from ns.TypedClient.BaseClient:
github.com/elastic/go-elasticsearch/v8.BaseClient contains sync.RWMutex

This fixes that.

arp242 avatar Sep 11 '24 21:09 arp242

💚 CLA has been signed

Thank you, however I'm closing this in favor of #957

Anaethelion avatar Apr 17 '25 12:04 Anaethelion