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

Milvus
Zilliz
< Docs
  • Go

CreateAlias()

This method creates an alias and associates it with the specified collection.

func (c *Client) CreateAlias(ctx context.Context, option CreateAliasOption, callOptions ...grpc.CallOption) error

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

option

Optional parameters of the methods.

CreateAliasOption

callOpts

Optional parameters for calling the methods.

grpc.CallOption

CreateAliasOption

This is an interface type. The createAliasOption struct type implements this interface type.

You can use the NewCreateAliasOption() function to get the concrete implementation.

NewCreateAliasOption

The signature of this method is as follows:

func NewCreateAliasOption(collectionName, alias string) *createAliasOption

Parameter

Description

Type

collectionName

Name of the target collection.

string

alias

Alias to be created and assigned to the collection.

string

Return

Null

Example

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

err = client.CreateAlias(ctx, milvusclient.NewCreateAliasOption("customized_setup_2", "bob"))
if err != nil {
    // handle error
}

err = client.CreateAlias(ctx, milvusclient.NewCreateAliasOption("customized_setup_2", "alice"))
if err != nil {
    // handle error
}

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?