func NewClient(clusterURL string, httpClient *http.Client) (*Client, error) {
	u, err := url.Parse(clusterURL)
	if err != nil {
		return nil, errors.Wrap(err, "failed to parse cluster URL")
	}
	var clusterEndpoint string
	if u.User == nil {
		clusterEndpoint = fmt.Sprintf("%s://%s", u.Scheme, u.Host)
	} else {
		password, _ := u.User.Password()
		clusterEndpoint = fmt.Sprintf("%s://%s:%s@%s", u.Scheme, u.User.Username(), password, u.Host)
	}
	var client *elastic.Client
	client, err = elastic.NewClient(
		elastic.SetURL(clusterEndpoint),
		elastic.SetSniff(false),
	)
	if err != nil {
		return nil, errors.Wrap(err, "failed to create Elasticsearch API client")
	}
	return &Client{
		client:          client,
		clusterEndpoint: clusterEndpoint,
		httpClient:      httpClient,
		ctx:             context.Background(),
	}, nil
}
NewClient creates new Client object
package v5
import (
	"context"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"github.com/pkg/errors"
	"gopkg.in/olivere/elastic.v5"
)
type Client struct {
	client          *elastic.Client
	clusterEndpoint string
	httpClient      *http.Client
	ctx             context.Context
}