🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz
< Docs
  • Go
    • Client

New()

This method creates a Milvus client that connects to a specific Milvus deployment.

func New(ctx context.Context, config *ClientConfig) (*Client, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

config

Client configurations. For details, refer to the ClientConfig section.

ClientConfig

ClientConfig

This struct type defines all possible client configuration items as follows:

type ClientConfig struct {
    Address  string // Remote address, "localhost:19530".
    Username string // Username for auth.
    Password string // Password for auth.
    DBName   string // DBName for this client.
    EnableTLSAuth bool   // Enable TLS Auth for transport security.
    APIKey        string // API key
    RetryRateLimit *RetryRateLimitOption // option for retry on rate limit inteceptor
}

Parameter

Description

Type

Address

Specifies the address of your Milvus deployment.

string

Username

Specifies a valid username for authentication.

string

Password

Specifies the password of the above user.

string

DBName

Specifies the database to access.

string

EnableTLSAuth

Specifies whether to connect with TLS authentication enabled.

bool

RetryRateLimit

Specifies the retry rate limit in case the connection fails. For details, refer to the RetryRateLimitOption section.

*RetryRateLimitOption

RetryRateLimitOption

This struct type defines the retry options for the connection.

type RetryRateLimitOption struct {
    MaxRetry   uint
    MaxBackoff time.Duration
}

Parameter

Description

Type

MaxRetry

Specifies the maximum number of times the client should retry the connection.

uint

MaxBackoff

Specifies the maximum back-off duration for the connection.

time.Duration

Return

A Client object.

Example

import (
   "context"
   "github.com/milvus-io/milvus/v2/milvusclient"
)

mclient, err := client.NewClient(context.Background(), client.ClientConfig{
   Address: "http://localhost:19530",
})

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?