Support external es that enables HTTPS

Signed-off-by: wanjunlei <wanjunlei@yunify.com>
This commit is contained in:
wanjunlei
2021-08-25 16:39:53 +08:00
parent 9dfb736a03
commit 41b3551526
3 changed files with 21 additions and 0 deletions

View File

@@ -19,9 +19,11 @@ package v5
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http"
"time" "time"
"github.com/elastic/go-elasticsearch/v5" "github.com/elastic/go-elasticsearch/v5"
@@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela
Addresses: []string{address}, Addresses: []string{address},
Username: username, Username: username,
Password: password, Password: password,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}) })
return &Elastic{client: client, index: index}, err return &Elastic{client: client, index: index}, err

View File

@@ -19,9 +19,11 @@ package v6
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http"
"time" "time"
"github.com/elastic/go-elasticsearch/v6" "github.com/elastic/go-elasticsearch/v6"
@@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela
Addresses: []string{address}, Addresses: []string{address},
Username: username, Username: username,
Password: password, Password: password,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}) })
return &Elastic{Client: client, index: index}, err return &Elastic{Client: client, index: index}, err

View File

@@ -19,9 +19,11 @@ package v7
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http"
"time" "time"
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7"
@@ -46,6 +48,11 @@ func New(address string, basicAuth bool, username, password, index string) (*Ela
Addresses: []string{address}, Addresses: []string{address},
Username: username, Username: username,
Password: password, Password: password,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}) })
return &Elastic{client: client, index: index}, err return &Elastic{client: client, index: index}, err