Exemplo n.º 1
0
func NewClient(URL string, username string, password string, appname string) (*Client, error) {
	conn, err := connection.NewConnection(URL, username, password, appname)
	if err != nil {
		return nil, err
	}

	client := &Client{
		conn: conn,
	}

	return client, nil
}
Exemplo n.º 2
0
func TestActions(t *testing.T) {
	var client *elastic.Client
	var conn *connection.Connection
	var err error

	client, err = elastic.NewClient(elastic.SetURL(URL), elastic.SetBasicAuth(username, password), elastic.SetSniff(false))
	if err != nil {
		log.Fatalln(err)
		return
	}

	conn, err = connection.NewConnection(URL, username, password, appname)
	if err != nil {
		log.Fatalln(err)
		return
	}

	GetServiceTest(t, client, conn)
	GetStreamServiceTest(t, client, conn)
	DeleteServiceTest(t, client, conn)
	IndexServiceTest(t, client, conn)
	UpdateServiceTest(t, client, conn)
	SearchServiceTest(t, client, conn)
}