Support external es that enables HTTPS
Signed-off-by: wanjunlei <wanjunlei@yunify.com>
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user