feat:完善网站信息,修改留言信息模块

This commit is contained in:
henry
2021-12-20 17:07:39 +08:00
parent a66d120b3f
commit b0a9ef3569
7 changed files with 69 additions and 3 deletions

View File

@ -1,15 +1,35 @@
package es
import (
"context"
"github.com/elastic/go-elasticsearch/v7/esapi"
"github.com/olivere/elastic/v7"
"strings"
"testing"
)
var (
dataIndex = "test"
//client *elastic.Client
host = "http://192.168.0.188:9200"
)
func TestNewInstance(t *testing.T) {
client, err := elastic.NewClient(elastic.SetSniff(false), elastic.SetURL(host))
if err != nil {
panic(err)
}
if _, _, err = client.Ping(host).Do(context.Background()); err != nil {
t.Log(err)
return
}
//client.CreateIndex(dataIndex).BodyJson().Do(context.Background())
esversion, _ := client.ElasticsearchVersion(host)
t.Log(esversion)
}
func TestNewInstance1(t *testing.T) {
NewInstance(
WithEsAddress([]string{"http://192.168.0.188:9200"}),
).Init().Local()
@ -21,3 +41,13 @@ func TestNewInstance(t *testing.T) {
t.Log(err)
t.Log(resp)
}
func TestNewInstance2(t *testing.T) {
NewInstance(
WithEsAddress([]string{"http://192.168.0.188:9200"}),
).Init().Local()
client.Search(func(request *esapi.SearchRequest) {
})
}