LoadCollection()
This method loads the specified collection to memory (for search and query).
func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error
Request Parameters
Parameter | Description | Type |
---|---|---|
| Context for the current call to work. |
|
| Name of the collection to load. |
|
| Whether to execute this request asynchronously. |
|
| Extra settings for this request. |
|
client.LoadCollectionOption
You can add extra settings to the LoadCollection()
request using the following methods.
Method | Description |
---|---|
| Number of replicas to create upon the load of the collection. |
| A list of specific resource groups used to load the replicas. |
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 collection with the specified name does not exist. -
The call to this API fails.
Example
// load collection
errLoad := mc.LoadCollection(context.Background(), collectionName, false, client.WithReplicaNumber(1))
if errLoad != nil {
log.Fatal("failed to load collection:", errLoad.Error())
}