MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / InitES

Function InitES

ioc/es.go:9–21  ·  view source on GitHub ↗

InitES 初始化elasticsearch

()

Source from the content-addressed store, hash-verified

7
8// InitES 初始化elasticsearch
9func InitES() *elasticsearch.TypedClient {
10 addr := viper.GetString("es.addr")
11 cfg := elasticsearch.Config{
12 Addresses: []string{
13 addr,
14 },
15 }
16 client, err := elasticsearch.NewTypedClient(cfg)
17 if err != nil {
18 panic(err)
19 }
20 return client
21}

Callers 1

InitWebServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected