< Docs
  • Java


A MilvusClient interface. This method lists all the collections or gets the collection loading status.

R<ShowCollectionsResponse> showCollections(ShowCollectionsParam requestParam);


Use the ShowCollectionsParam.Builder to construct a ShowCollectionsParam object.

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

Methods of ShowCollectionsParam.Builder:

Method Description Parameters
withCollectionNames(List\ collectionNames) Sets a list of collection names. If the list is empty, the method will return all the collections in database.
Collection name cannot be empty or null.
collectionNames: A list of the collection names to show.
addCollectionName(String collectionName) Adds a collection name. Collection name cannot be empty or null. collectionName: The name of the collection to show.
build() Constructs a ShowCollectionsParam 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<ShowCollectionsResponse> 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 the error message of the exception.

  • If the API succeeds, it returns a valid ShowCollectionsResponse held by the R template. You can use ShowCollResponseWrapper to get the information.


A tool class to encapsulate the ShowCollectionsResponse.

import io.milvus.response.ShowCollResponseWrapper;
ShowCollResponseWrapper wrapper = new ShowCollResponseWrapper(showCollectionsResponse);

Methods of ShowCollResponseWrapper:

Method Description Parameters Returns
Returns a list of CollectionInfo objects. Each CollectionInfo represents a collection. N/A List\
getCollectionInfoByName(String collectionName) Gets a CollectionInfo object by collection name.
collectionName: The collection name. CollectionInfo


A tool class to store a collection's information.

Methods of ShowCollResponseWrapper.CollectionInfo:

Method Description Returns
getName() Gets the name of the collection. String
getId() Gets the ID of the collection. long
getUtcTimestamp() Gets a UTC timestamp that indicates when this collection is created. This method is for internal usage. long
Load percentage on query node.


import io.milvus.param.*;
import io.milvus.response.ShowCollResponseWrapper;
import io.milvus.grpc.ShowCollectionsResponse;

ShowCollectionsParam param = ShowCollectionsParam.newBuilder()
R<ShowCollectionsResponse> response = client.showCollections(param);
if (response.getStatus() != R.Status.Success.getCode()) {

ShowCollResponseWrapper wrapper = new ShowCollResponseWrapper(response.getData());
System.out.println("Row count: " + wrapper.getRowCount());

List<ShowCollResponseWrapper.CollectionInfo> infos = wrapper.getCollectionsInfo();
for (ShowCollResponseWrapper.CollectionInfo info : infos) {
    System.out.println(info.getName() + " load percentage: " + info.getInMemoryPercentage() + "%");