< Docs
  • Java


MilvusClient interface. This method shows all partitions in the 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:

Method Description Parameters
withCollectionName(String collectionName) Set the collection name. Collection name cannot be empty or null. collectionName: The target collection name.
withPartitionNames(List\ partitionNames) Set the partition names list. Partition names list cannot be null or empty. partitionNames: The name list of partitions to show.
addPartitionName(String partitionName) Add a partition by name. Partition name cannot be empty or null. partitionName: A target partition name.
build() Construct 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.Unknown and 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 information easily.


A tool class to encapsulate the ShowPartitionsResponse.

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

Methods of ShowPartitionsResponse:

Method Description Parameters Returns
Return a list of PartitionInfo. N/A List\
getPartitionInfoByName(String partitionName)
Return a PartitionInfo object by a partition name. partitionName: The target partition name. PartitionInfo


A tool class to hold information of a partition.

Methods of ShowPartitionsResponse.PartitionInfo

Method Description Returns
getIndexType() Get index type. IndexType
getMetricType() Get metric type. MetricType
getExtraParam() Get 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() + "%");