milvus-logo
LFAI
< Docs
  • Go

CreatePartition()

This method creates a partition in the specified collection.

Invocation

client.CreatePartition(ctx, collName, partName)

Parameters

ParameterDescriptionType
ctxContext to control API invocation processcontext.Context
collNameName of the collection to create a partition inString
partNameName of the partition to createString

Return

A new partition object corresponded to the name in the specified collection.

Errors

err: error in the process (if any). Possible errors are listed below:

  • ErrClientNotReady, error that the client is not connected.

  • ErrCollectionNotExists, error that the collection with the specified name does not exist.

  • error that partition with the same name already exists.

  • error that API invocation failed.

Example

err := milvusClient.CreatePartition(
  context.Background(),
  "book",
  "novel"
)
if err != nil {
  log.Fatal("failed to create partition:", err.Error())
}
Feedback

Was this page helpful?