package utils

import (
	"github.com/olivere/elastic/v7"
)

// EsClient es客户端
var EsClient *elastic.Client

func initEs() {
	client, err := elastic.NewClient(
		elastic.SetURL(ES_URL),
		elastic.SetBasicAuth(ES_USERNAME, ES_PASSWORD),
		elastic.SetSniff(false))
	if err != nil {
		panic("ElasticSearch连接失败,err:" + err.Error())
		//go alarm_msg.SendAlarmMsg("ElasticSearch连接失败", 2)
	}
	EsClient = client
	return
}