Elasticsearch: Fix failing requests when using SigV4 (#61923)

fix setting of `es` servicename
This commit is contained in:
Sven Grossmann 2023-01-23 16:43:55 +01:00 committed by GitHub
parent 5eca966f45
commit c5610450b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,16 +74,16 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
return nil, fmt.Errorf("error getting http options: %w", err)
}
httpCli, err := httpClientProvider.New(httpCliOpts)
if err != nil {
return nil, err
}
// Set SigV4 service namespace
if httpCliOpts.SigV4 != nil {
httpCliOpts.SigV4.Service = "es"
}
httpCli, err := httpClientProvider.New(httpCliOpts)
if err != nil {
return nil, err
}
version, err := coerceVersion(jsonData["esVersion"])
if err != nil {
return nil, fmt.Errorf("elasticsearch version is required, err=%v", err)