CreateAlias()
Addedv2.5.x
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 | 
|---|---|---|
| 
 | Context for the current call to work. | 
 | 
| 
 | Optional parameters of the methods. | |
| 
 | Optional parameters for calling the methods. | 
 | 
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 | 
|---|---|---|
| 
 | Name of the target collection. | 
 | 
| 
 | Alias to be created and assigned to the collection. | 
 | 
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
}