background/db/elasticEngine.go

34 lines
496 B
Go

package db
import (
"background/config"
"background/logs"
"gopkg.in/olivere/elastic.v3"
)
type ElkEngine struct {
cli *elastic.Client
}
var gElkEngine ElkEngine
func InitELK() {
var e error
elkconf := config.GetElkConfig()
gElkEngine.cli,e = elastic.NewClient(
elastic.SetURL(elkconf.Address),
// Must turn off sniff in docker
elastic.SetSniff(false),)
if nil != e{
logs.Error(e.Error())
gElkEngine.cli = nil
}
}
func (*ElkEngine)Search() (error) {
return nil
}