123456789101112131415161718192021222324252627282930313233 |
- package elastic
- import (
- "github.com/olivere/elastic/v7"
- "hongze/hongze_yb_en_api/global"
- )
- const (
- ES_URL = "http://es-cn-nif227b580019rgw6.public.elasticsearch.aliyuncs.com:9200" //<1>
- ES_USERNAME = "elastic" //<2>
- ES_PASSWORD = "hongze@2021" //<3>
- //Grafana pwd-> 20521bb9
- //Grafana username-> emon
- )
- // es相关
- var (
- EsEnglishReportIndexName string
- )
- func init() {
- if global.CONFIG.Serve.RunMode == "debug" {
- EsEnglishReportIndexName = "test_english_report_v1" //报告
- }else{
- EsEnglishReportIndexName = "english_report_v1" //报告
- }
- }
- func NewClient() (client *elastic.Client, err error) {
- client, err = elastic.NewClient(
- elastic.SetURL(ES_URL),
- elastic.SetBasicAuth(ES_USERNAME, ES_PASSWORD),
- elastic.SetSniff(false))
- return
- }
|