From 41b3551526b77971c511cb5ef91077f87d395683 Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 25 Aug 2021 16:39:53 +0800 Subject: [PATCH] Support external es that enables HTTPS Signed-off-by: wanjunlei --- pkg/simple/client/es/versions/v5/v5.go | 7 +++++++ pkg/simple/client/es/versions/v6/v6.go | 7 +++++++ pkg/simple/client/es/versions/v7/v7.go | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/pkg/simple/client/es/versions/v5/v5.go b/pkg/simple/client/es/versions/v5/v5.go index 42e32d356..351d03a0f 100644 --- a/pkg/simple/client/es/versions/v5/v5.go +++ b/pkg/simple/client/es/versions/v5/v5.go @@ -19,9 +19,11 @@ package v5 import ( "bytes" "context" + "crypto/tls" "encoding/json" "fmt" "io/ioutil" + "net/http" "time" "github.com/elastic/go-elasticsearch/v5" @@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela Addresses: []string{address}, Username: username, Password: password, + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, }) return &Elastic{client: client, index: index}, err diff --git a/pkg/simple/client/es/versions/v6/v6.go b/pkg/simple/client/es/versions/v6/v6.go index b18754496..ef4e2ae74 100644 --- a/pkg/simple/client/es/versions/v6/v6.go +++ b/pkg/simple/client/es/versions/v6/v6.go @@ -19,9 +19,11 @@ package v6 import ( "bytes" "context" + "crypto/tls" "encoding/json" "fmt" "io/ioutil" + "net/http" "time" "github.com/elastic/go-elasticsearch/v6" @@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela Addresses: []string{address}, Username: username, Password: password, + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, }) return &Elastic{Client: client, index: index}, err diff --git a/pkg/simple/client/es/versions/v7/v7.go b/pkg/simple/client/es/versions/v7/v7.go index b85a6dce0..d76565b96 100644 --- a/pkg/simple/client/es/versions/v7/v7.go +++ b/pkg/simple/client/es/versions/v7/v7.go @@ -19,9 +19,11 @@ package v7 import ( "bytes" "context" + "crypto/tls" "encoding/json" "fmt" "io/ioutil" + "net/http" "time" "github.com/elastic/go-elasticsearch/v7" @@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela Addresses: []string{address}, Username: username, Password: password, + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, }) return &Elastic{client: client, index: index}, err