diff --git a/pkg/tsdb/elasticsearch/elasticsearch.go b/pkg/tsdb/elasticsearch/elasticsearch.go index 7d84751a60d..1ee28d0e740 100644 --- a/pkg/tsdb/elasticsearch/elasticsearch.go +++ b/pkg/tsdb/elasticsearch/elasticsearch.go @@ -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)