A MilvusClient interface. This method shows all the partitions in a specified collection.

R<ShowPartitionsResponse> showPartitions(ShowPartitionsParam requestParam);


Use the ShowPartitionsParam.Builder to construct a ShowPartitionsParam object.

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

Methods of ShowPartitionsParam.Builder:

withCollectionName(String collectionName)Sets the collection name. The collection name cannot be empty or null.collectionName: The name of the collection whose partitions needs to be listed.
withPartitionNames(List<String> partitionNames)Sets the partition name list. The partition name list cannot be empty or null.partitionNames: A list of the names of the partitions to list.
addPartitionName(String partitionName)Adds a partition by name. The partition name cannot be empty or null.partitionName: The name of the partition to list.
build()Constructs a ShowPartitionsParam 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<ShowPartitionsResponse> 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 ShowPartitionsResponse held by the R template. You can use ShowPartResponseWrapper to get the information easily.


A tool class to encapsulate the ShowPartitionsResponse.

import io.milvus.response.ShowPartResponseWrapper;
ShowPartResponseWrapper wrapper = new ShowPartResponseWrapper(showPartitionsResponse);

Methods of ShowPartitionsResponse:

getPartitionsInfo()Returns a list of PartitionInfo.N/AList<PartitionInfo>
getPartitionInfoByName(String partitionName)Returns a PartitionInfo object by the partition name.partitionName: The name of the partition to list.PartitionInfo


A tool class to hold information of a partition.

Methods of ShowPartitionsResponse.PartitionInfo:

getIndexType()Gets the index type.IndexType
getMetricType()Gets the metric typeMetricType
getExtraParam()Gets the index parameters in JSON format.String


import io.milvus.param.*;
import io.milvus.grpc.ShowPartitionsResponse;
import io.milvus.response.ShowPartResponseWrapper;

ShowPartitionsParam param = ShowPartitionsParam.newBuilder()
R<ShowPartitionsResponse> response = client.showPartitions(param);
if (response.getStatus() != R.Status.Success.getCode()) {

ShowPartResponseWrapper wrapper = new ShowPartResponseWrapper(response.getData());
ShowPartResponseWrapper.PartitionInfo info = wrapper.getPartitionInfoByName("_default");
System.out.println("Partition name: " + info.getName() + ", ID: " + info.getId() + ", in-memory: " + info.getInMemoryPercentage() + "%");