package es import ( "strings" "testing" ) var ( dataIndex = "test" ) func TestNewInstance(t *testing.T) { NewInstance( WithEsAddress([]string{"http://192.168.0.188:9200"}), ).Init().Local() var b strings.Builder b.WriteString(`{"title" : "`) b.WriteString("我是好人") b.WriteString(`"}`) resp, err := client.Create(dataIndex, "2", strings.NewReader(b.String())) t.Log(err) t.Log(resp) }