< Docs
  • Java


A MilvusClient interface. This method shows the details of a collection, e.g. name, schema.

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:

Method Description Parameters
withCollectionName(String collectionName) Sets the collection name. Collection name cannot be empty or null. collectionName: The name of the collection to release.
build() Constructs a ReleaseCollectionParam 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.Unknown 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(response);

Methods of DescCollResponseWrapper:

Method Description Parameters Returns
getCollectionName() Get the name of the collection. N/A String
getCollectionDescription() Get the description of the collection.
N/A String
getCollectionID() Get the internal ID of the collection. N/A long
getShardNumber() Get the shard number of the collection. N/A int
getCreatedUtcTimestamp() Get UTC timestamp when the collection is created. N/A
getAliases() Get aliases of the collection. N/A List\
getFields() Get the schema of the collection's fields. N/A List\
getFieldByName(String fieldName) Get the schema of a field by name.
Return null if the field doesn't exist.
fieldName: The name of a field FieldType
isDynamicFieldEnabled() Get whether the collection dynamic field is enabled N/A boolean
getPartitionKeyField() Get the partition key field.
Return null if the partition key field doesn't exist.
N/A FieldType


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

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("Shard number: " + wrapper.getShardNumber());

Was this page helpful?