Merge pull request #4176 from wanjunlei/https
Support external es that enables HTTPS
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user