Browse Source

fix:补充提交

master
燕鹏 3 years ago
parent
commit
810b30e54a
  1. 34
      utils/EsUtil.go

34
utils/EsUtil.go

@ -4,9 +4,13 @@ import (
"beeblog/models" "beeblog/models"
"context" "context"
"fmt" "fmt"
beego "github.com/beego/beego/v2/server/web"
"github.com/olivere/elastic" "github.com/olivere/elastic"
"log"
"os"
"reflect" "reflect"
"strconv" "strconv"
"time"
) )
var client *elastic.Client var client *elastic.Client
@ -44,21 +48,21 @@ const mapping = `
} }
}` }`
//func init() { func init() {
// host, _ := beego.AppConfig.String("eshost") host, _ := beego.AppConfig.String("eshost")
// var err error var err error
// client, err = elastic.NewClient( client, err = elastic.NewClient(
// elastic.SetURL(host), elastic.SetURL(host),
// elastic.SetSniff(false), elastic.SetSniff(false),
// elastic.SetHealthcheckInterval(10*time.Second), elastic.SetHealthcheckInterval(10*time.Second),
// elastic.SetGzip(true), elastic.SetGzip(true),
// elastic.SetErrorLog(log.New(os.Stderr, "ELASTIC ", log.LstdFlags)), elastic.SetErrorLog(log.New(os.Stderr, "ELASTIC ", log.LstdFlags)),
// elastic.SetInfoLog(log.New(os.Stdout, "", log.LstdFlags))) elastic.SetInfoLog(log.New(os.Stdout, "", log.LstdFlags)))
//
// if err != nil { if err != nil {
// panic(err) panic(err)
// } }
//} }
func Index() { func Index() {
ctx := context.Background() ctx := context.Background()

Loading…
Cancel
Save