Go SDK Reference
The Go SDK provides a native Go client for Zilliz Cloud. The current v2 module is maintained under the client/ directory of the main Milvus repository and exposes the milvusclient package for connection management, collection operations, data writes, vector search, and cluster administration.
Features
- Idiomatic Go client — Create a
milvusclient.Clientwithcontext.Contextand a typedClientConfig. - Option-based requests — Configure operations with constructors such as
NewListCollectionOption()and chainable option methods. - Collection and index management — Define schemas, create collections and indexes, and manage collection loading.
- Data and vector operations — Insert, upsert, delete, query, search, and run hybrid searches with typed vectors and result sets.
- Cloud administration — Manage databases, partitions, aliases, users, roles, and resource groups available to your cluster.
- Go ecosystem integration — Pass contexts and optional gRPC call options through SDK operations and close clients explicitly when work is complete.
Installation
Install the current v2 module and its dependencies with go get:
go get -u github.com/milvus-io/milvus/client/v2
Use the Go version required by the selected SDK module's go.mod file.
Connect to Zilliz Cloud
Copy the public endpoint from the cluster Connect card and use an API key or cluster credential as the token.
import (
"context"
"fmt"
"log"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_ENDPOINT",
APIKey: "YOUR_CLUSTER_TOKEN",
})
if err != nil {
log.Fatal(err)
}
defer cli.Close(ctx)
collectionNames, err := cli.ListCollections(
ctx,
milvusclient.NewListCollectionOption(),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(collectionNames)
Resources
Overview
The Go SDK provides a native Go client for Zilliz Cloud. The current v2 module is maintained under the client/ directory of the main Milvus repository and exposes the milvusclient package for connection management, collection operations, data writes, vector search, and cluster administration.
Authentication
20 items
Client
5 items
Collection
30 items
Snapshot
9 items
Vector
21 items
Database
8 items
DataImport
9 items
Management
24 items
Partition
5 items