跳到主要内容

loadPartitions()

Addedv2.3.xModifiedv2.6.x

This operation releases the partitions in a specified collection from memory.

public void loadPartitions(LoadPartitionsReq request)

Request Syntax

loadPartitions(LoadPartitionsReq.builder()
.databaseName(String databaseName)
.collectionName(String collectionName)
.partitionNames(List<String> partitionNames)
.numReplicas(Interger numReplicas)
.sync(Boolean sync)
.timeout(Long timeout)
.refresh(Boolean refresh)
.loadFields(List<String> loadFields)
.build()
)

BUILDER METHODS:

  • databaseName(String databaseName)

    The name of the database to which the target collection belongs.

  • collectionName(String collectionName)

    The name of an existing collection.

  • partitionNames(List<String> partitionNames)

    A list of the names of the partitions to load.

  • numReplicas(Interger numReplicas)

    The number of replicas to create during the load process.

  • sync(Boolean sync)

    Whether the current operation is synchronous.

    The value defaults to Boolean.True, indicating that the operation returns only after the specified partitions are fully loaded.

  • timeout(Long timeout)

    The timeout duration for this operation. The value defaults to 60000L, indicating the operation times out after 1000 hours.

  • refresh(Boolean refresh)

    Whether to refresh the data after load.

  • loadFields(List<String> loadFields)

    A name list of the fields to load during the process.

RETURNS:

void

EXCEPTIONS:

  • MilvusClientExceptions

    This exception will be raised when any error occurs during this operation.

Example

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.service.partition.request.LoadPartitionsReq;

// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("YOUR_CLUSTER_ENDPOINT")
.token("YOUR_CLUSTER_TOKEN")
.build();

MilvusClientV2 client = new MilvusClientV2(connectConfig);

// 2. Load partition in collection
LoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()
.collectionName("test")
.partitionNames(Collections.singletonList("test_partition"))
.build();
client.loadPartitions(loadPartitionsReq);