feat:优化项目信息

This commit is contained in:
henry
2022-02-15 17:19:23 +08:00
parent cbc0ad1a41
commit dcb5948e91
45 changed files with 852 additions and 100 deletions

View File

@ -61,7 +61,7 @@ func TestNewInstanceUpdate(t *testing.T) {
//client.Delete()
src := &Student{ID: 1, Name: "Henry", Age: 28}
_, err := client.Update().Index("student").Id(fmt.Sprintf("%d", src.ID)).Doc(map[string]interface{}{
_, err := client.Update().Index("es_achievement_index").Id(fmt.Sprintf("%d", src.ID)).Doc(map[string]interface{}{
"age": 29,
}).Do(context.Background())
t.Log(err)
@ -74,7 +74,7 @@ func TestNewInstanceSearch(t *testing.T) {
query := elastic.NewBoolQuery()
//query.Must(elastic.NewMatchQuery("age", "27"))
service := client.Search().Index("es_achievement_index")
service := client.Search().Index("es_manage_index_2")
result, err := service.Pretty(true).Query(query).Do(context.Background())
@ -92,6 +92,15 @@ func TestNewInstanceSearch(t *testing.T) {
}
}
func TestNewInstanceDelete(t *testing.T) {
client := _new()
//client.Delete()
_, err := client.Delete().Index("es_achievement_index").Id("5").Do(context.Background())
t.Log(err)
}
func TestNewInstance2(t *testing.T) {
client := _new()
@ -101,7 +110,7 @@ func TestNewInstance2(t *testing.T) {
service := client.Search().
//Index("es_patent_index")
Index("es_manage_index_2")
Index("es_achievement_index")
result, err := service.From(0).Size(10).
//Explain(true).