Files
milvus/client
yanliang567andGitHub a040281e20 enhance: Add Go SDK search aggregation support (#50448)
issue: #49046

## What
- Add Go SDK builders for search aggregation and top hits, including
validation and proto request wiring.
- Parse search aggregation responses from `AggBuckets`/`AggTopks` into
`ResultSet.AggregationBuckets`.
- Reject incompatible search options such as legacy group-by, offset,
and search iterator usage.
- Add unit tests, a Go SDK example, and Go E2E coverage for search
aggregation.

## Tests
- `cd client && go test ./... -count=1`
- `cd tests/go_client && GO_CLIENT_SKIP_EXTERNAL_TABLE_DEPS_INSTALL=true
go test ./testcases -run TestSearchAggregation -count=1 -args -addr
http://10.104.18.101:19530`

## Notes
- `make static-check` was attempted locally but blocked by missing LLVM:
`ERROR: Valid LLVM (14-18) not installed. Run: brew install llvm@17`.

Signed-off-by: Yanliang Qiao <yanliang.qiao@zilliz.com>
2026-06-11 14:10:20 +08:00
..

Go MilvusClient

license Go Reference

Go MilvusClient for Milvus. To contribute code to this project, please read our contribution guidelines first.

Getting started

Prerequisites

Go 1.24.12 or higher

Install Milvus Go SDK

  1. Use go get to install the latest version of the Milvus Go SDK and dependencies:

    go get -u github.com/milvus-io/milvus/client/v2
    
  2. Include the Go MilvusClient in your application:

     import "github.com/milvus-io/milvus/client/v2/milvusclient"
    
     //...other snippet ...
     ctx, cancel := context.WithCancel(context.Background())
     defer cancel()
    
     milvusAddr := "YOUR_MILVUS_ENDPOINT"
    
     cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
     	Address: milvusAddr,
     })
     if err != nil {
     	// handle error
     }
    
     // Do your work with milvus client
    

API Documentation

Refer to https://milvus.io/api-reference/go/v2.5.x/About.md for the Go SDK API documentation.

Code format

The Go source code is formatted using gci & gofumpt. Please run make lint-fix before sumbit a PR.