Add loger to elastic search client

This commit is contained in:
Mak Muftic 2021-09-17 14:22:57 +02:00
parent 7d0aefacbb
commit 0962e73e3e

View File

@ -5,14 +5,16 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/url" "net/url"
"os"
"strings" "strings"
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v7/esapi" "github.com/elastic/go-elasticsearch/v7/esapi"
"github.com/elastic/go-elasticsearch/v7/estransport"
) )
const ( const (
ElasticSearch_INDEX = "lotus" ElasticSearch_INDEX = "lotus2"
ElasticSearch_DOC_LOTUS = "doc_lotus" ElasticSearch_DOC_LOTUS = "doc_lotus"
ElasticSearch_DOC_PUBSUB = "doc_pubsub" ElasticSearch_DOC_PUBSUB = "doc_pubsub"
@ -29,6 +31,11 @@ func NewElasticSearchTransport(connectionString string) (TracerTransport, error)
}, },
Username: username, Username: username,
Password: password, Password: password,
Logger: &estransport.CurlLogger{
Output: os.Stdout,
EnableRequestBody: true,
EnableResponseBody: true,
},
} }
es, err := elasticsearch.NewClient(cfg) es, err := elasticsearch.NewClient(cfg)