package friend_circle import ( "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" "fmt" "testing" ) func TestCreateFriendCircleIndex(t *testing.T) { es.Init("http://123.57.140.192:9200", "elastic", "fnuo123") err := es.CreateIndexIfNotExists(md.EggFriendCircleEsIndex, md.EggFriendCircleEsMapping) if err != nil { fmt.Println(err) } fmt.Println("success") } func TestCreateFriendCircleCommentLikeIndex(t *testing.T) { es.Init("http://123.57.140.192:9200", "elastic", "fnuo123") for i := 0; i < 10; i++ { index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i) err := es.CreateIndexIfNotExists(index, md.EggFriendCircleLikeEsMapping) if err != nil { fmt.Println(err) } } fmt.Println("success") } func TestCreateFriendCircleCommentIndex(t *testing.T) { es.Init("http://123.57.140.192:9200", "elastic", "fnuo123") for i := 0; i < 10; i++ { index := fmt.Sprintf("%s%d", md.EggFriendCircleCommentEsIndex, i) err := es.CreateIndexIfNotExists(index, md.EggFriendCircleCommentEsMapping) if err != nil { fmt.Println(err) } } fmt.Println("success") } func TestDeleteIndex(t *testing.T) { es.Init("http://123.57.140.192:9200", "elastic", "fnuo123") for i := 0; i < 10; i++ { index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i) _, err := es.DeleteIndex(index) if err != nil { fmt.Println(err) return } } fmt.Println("success") }