Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: CA cert error (#12082)

Azusaind2d79143c67e
diff --git a/backend/plugin/db/elasticsearch/elasticsearch.go b/backend/plugin/db/elasticsearch/elasticsearch.go
index 8f66a3626d..169189eab5 100644
--- a/backend/plugin/db/elasticsearch/elasticsearch.go
+++ b/backend/plugin/db/elasticsearch/elasticsearch.go
@@ -91,13 +91,17 @@ func (*Driver) Open(_ context.Context, _ storepb.Engine, config db.ConnectionCon
}
}
- // typed elasticsearch client.
- typedClient, err := elasticsearch.NewTypedClient(elasticsearch.Config{
+ esConfig := elasticsearch.Config{
Username: config.Username,
Password: config.Password,
Addresses: addresses,
- CACert: []byte(config.TLSConfig.SslCert),
- })
+ }
+ if protocol == "https" {
+ esConfig.CACert = []byte(config.TLSConfig.SslCert)
+ }
+
+ // typed elasticsearch client.
+ typedClient, err := elasticsearch.NewTypedClient(esConfig)
if err != nil {
return nil, errors.Wrapf(err, "failed to create elasticsearch client")
}