< Docs
  • Java


A MilvusClient interface. This method returns the detailed information of a compaction operation, including the state indicating if the operation is completed or not, its sub tasks (i.e. the plans), and more.

R<GetCompactionPlansResponse> getCompactionStateWithPlans(GetCompactionPlansParam requestParam)


Use the GetCompactionPlansParam.Builder to construct a GetCompactionPlansParam object.

import io.milvus.param.GetCompactionPlansParam;
GetCompactionPlansParam.Builder builder = GetCompactionPlansParam.newBuilder();

Methods of GetCompactionPlansParam.Builder:

withCompactionID(Long compactionID)Sets the ID of the compaction operation.compactionID: The ID of the compaction operation whose detailed information needs to be checked.
build()Constructs a GetCompactionPlansParam object.N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R<GetCompactionPlansResponse> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknow and the error message of the exception.

  • If the API succeeds, it returns a valid GetCompactionPlansResponse held by the R template.


import io.milvus.param.*;
import io.milvus.grpc.GetCompactionPlansResponse;
import io.milvus.grpc.CompactionMergeInfo;

GetCompactionPlansParam param = GetCompactionPlansParam.newBuilder()
R<GetCompactionPlansResponse> response = client.getCompactionStateWithPlans(param);
if (response.getStatus() != R.Status.Success.getCode()) {

GetCompactionPlansResponse compactionPlans = response.getData();
System.out.println("Compaction state: " + compactionPlans.getState());

for (int i = 0; i < compactionPlans.getMergeInfosCount(); i++) {
    CompactionMergeInfo info = compactionPlans.getMergeInfos(i);
    System.out.println("Merge segments " + info.getSourcesList().toString() + " into new segment " + info.getTarget());

Was this page helpful?