load()
This operation loads the data of the current partition into memory.
notes
Using the partition_names parameter in the load() method of a Collection object is equivalent to using the load() method of corresponding Partition objects.
Request Syntax
load(
replica_number: int,
timeout: float | None
)
PARAMETERS:
replica_number (int)
The number of replicas to load in the current partition. The default value is 1, indicating that one replica in the current partition is loaded.
timeout (float | None)
The timeout duration for this operation. Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
kwargs -
_resource_groups (list) -
A specific set of resource groups into which the current collection is to be loaded.
If left unspecified, the default resource group applies.
what is a resource group?
A resource group can hold several or all of the query nodes in a Milvus instance.
Setting this parameter for this operation makes Milvus loads the current collection to the query nodes in the specified resource groups.
RETURN TYPE:
NoneType
RETURNS:
None
EXCEPTIONS:
MilvusException
This arises when any error occurs during this operation.
Examples
from pymilvus import Collection, Partition, CollectionSchema, FieldSchema, DataType
schema = CollectionSchema([
FieldSchema("id", DataType.INT64, is_primary=True),
FieldSchema("vector", DataType.FLOAT_VECTOR, dim=5)
])
# Create a collection
collection = Collection(
name="test_collection",
schema=schema
)
# Create a partition
partition = Partition(
collection=collection,
name="test_partition"
)
# Load a partition with one replica of the collection data
partition.load()
# Load a partition with two replicas of the collection data
partition.load(
replica_number=2
)