< Docs
  • Java


A MilvusClient interface. This method shows the details of a collection, including collection name, schema, and more.

R<DescribeCollectionResponse> describeCollection(DescribeCollectionParam requestParam);


Use the DescribeCollectionParam.Builder to construct a DescribeCollectionParam object.

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

Methods of DescribeCollectionParam.Builder:

withCollectionName(String collectionName)Sets the collection name. The collection name cannot be empty or null.collectionName: The name of the collection to show details of.
build()Constructs a DescribeCollectionParam 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<DescribeCollectionResponse> 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 DescribeCollectionResponse held by the R template. You can use DescCollResponseWrapper to get the information.


A tool class to encapsulate the DescribeCollectionResponse.

import io.milvus.response.DescCollResponseWrapper;
DescCollResponseWrapper wrapper = new DescCollResponseWrapper(descCollectionResponse);

Methods of DescCollResponseWrapper:

getCollectionName()Gets the name of the collection.N/AString
getCollectionDescription()Gets the description of the collection.N/AString
getCollectionID()Gets the ID of the collection.N/Along
getShardNumber()Gets the number of shards of the collection.N/AInt
getCreatedUtcTimestamp()Gets the UTC timestamp that indicates when the collection is created.N/Along
getAliases()Gets the alias of the collection.N/AList
getFields()Gets all field schemas in the collection.N/AList<FieldType>
getFieldByName(String fieldName)Gets a field schema by its field name.fieldName: a field nameFieldType
isDynamicFieldEnabled()Get whether dynamic fields are allowed in the collection.N/Aboolean
getPartitionKeyField()Get the field on which partition key is enabled.N/AFieldType


import io.milvus.param.*;
import io.milvus.response.DescCollResponseWrapper;
import io.milvus.grpc.DescribeCollectionResponse;

DescribeCollectionParam param = DescribeCollectionParam.newBuilder()
R<DescribeCollectionResponse> response = client.describeCollection(param);
if (response.getStatus() != R.Status.Success.getCode()) {

DescCollResponseWrapper wrapper = new DescCollResponseWrapper(response.getData());
System.out.println("Collection ID: " + wrapper.getCollectionID());

Was this page helpful?