123456789101112131415161718192021222324 |
- package services
- import (
- "github.com/elastic/go-elasticsearch/v7"
- )
- /*
- Addresses []string // A list of Elasticsearch nodes to use.
- Logger estransport.Logger // The logger object.
- Selector estransport.Selector // The selector object.
- */
- // 官方库
- func NewEsV7Client() (client *elasticsearch.Client, err error) {
- conf := elasticsearch.Config{
- Addresses: []string{ES_URL},
- Username: ES_USERNAME,
- Password: ES_PASSWORD,
- }
- client, err = elasticsearch.NewClient(conf)
- return
- }
|