Skip to main content

CreatePartition()

This method creates a partition in a specific collection.

func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of a collection

string

partitionName

Name of the partition to create.

string

Return

Null

Errors

Any error in the execution of the request. Possible errors are as follows:

  • ErrClientNotReady: The client is not connected to Milvus.

  • ErrCollectionNotExists: The specified collection does not exist.

  • A partition with the specified name already exists.

  • The call to this API fails.

Example

// create partition
errPar := mc.CreatePartition(context.Background(), collectionName, "p1")
if errPar != nil {
log.Fatal("failed to create partition:", errPar.Error())
}