This commit is contained in:
henry
2021-11-02 09:43:19 +08:00
parent 570bb3c772
commit 4734344985
78 changed files with 4798 additions and 0 deletions

32
serve/es/es.go Normal file
View File

@ -0,0 +1,32 @@
package es
import "github.com/elastic/go-elasticsearch/v7"
type Es struct{ *EsConfig }
type EsConfig struct {
Address []string
}
type EsServer func(*EsConfig) *Es
var esClient = new(elasticsearch.Client)
func (this *Es) Run() {
obj := elasticsearch.Config{
Addresses: this.Address,
Username: "",
Password: "",
}
var err error
if esClient, err = elasticsearch.NewClient(obj); err != nil {
panic("Elasticsearch Error " + err.Error())
}
}
func NewEs() EsServer {
return func(config *EsConfig) *Es {
return &Es{config}
}
}

5
serve/es/serve.go Normal file
View File

@ -0,0 +1,5 @@
package es
func Set() {
esClient.Search()
}