Skip to main content

describeCollection()

This operation lists detailed information about a specific collection.

java
public DescribeCollectionResp describeCollection(DescribeCollectionReq request)

Request Syntax​

java
describeCollection(DescribeCollectionReq.builder()
.databaseName(String databaseName)
.collectionName(String collectionName)
.collectionId(Long collectionId)
.build()
);

BUILDER METHODS:

  • databaseName(String databaseName) -

    The name of the database. Defaults to the current database if not specified.

  • collectionName(String collectionName) -

    The name of the target collection.

  • collectionId(Long collectionId) -

    The numeric ID of the collection. Use this when you need to identify a collection by ID instead of name.

RETURN TYPE:

DescribeCollectionResp

RETURNS:

A DescribeCollectionResp object that contains detailed information about the specified collection.

PARAMETERS:

  • collectionName (String) -

    The name of the collection.

  • collectionID (Long) -

    The numeric ID of the collection.

  • databaseName (String) -

    The name of the database the collection belongs to.

  • description (String) -

    The description of the collection.

  • numOfPartitions (Long) -

    The number of partitions in the collection.

  • fieldNames (List<String>) -

    The names of all fields in the collection schema.

  • vectorFieldNames (List<String>) -

    The names of the vector fields.

  • primaryFieldName (String) -

    The name of the primary key field.

  • enableDynamicField (Boolean) -

    Whether the dynamic field is enabled.

  • autoID (Boolean) -

    Whether the primary key is auto-generated.

  • collectionSchema (CreateCollectionReq.CollectionSchema) -

    The collection schema.

  • createTime (Long) -

    The creation timestamp.

  • createUtcTime (Long) -

    The UTC creation timestamp.

  • consistencyLevel (ConsistencyLevel) -

    The consistency level of the collection.

  • shardsNum (Integer) -

    The number of shards.

  • properties (Map<String,String>) -

    The collection properties.

  • aliases (List<String>) -

    The aliases attached to the collection.

  • updateTimestamp (Long) -

    The last-update timestamp.

  • enableNamespace (Boolean) -

    Whether namespaces are enabled.

  • schemaVersion (Integer) -

    The schema version.

EXCEPTIONS:

  • MilvusClientException

    This exception will be raised when any error occurs during this operation.

Example​

java
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.service.collection.request.DescribeCollectionReq;
import io.milvus.v2.service.collection.response.DescribeCollectionResp;
import java.util.Set;

// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("YOUR_CLUSTER_ENDPOINT")
.token("YOUR_CLUSTER_TOKEN")
.build();

MilvusClientV2 client = new MilvusClientV2(connectConfig);

// 2. Get the collection detail
DescribeCollectionReq describeCollectionReq = DescribeCollectionReq.builder()
.collectionName("test")
.build();
DescribeCollectionResp describeCollectionResp = client.describeCollection(describeCollectionReq);
Minimum SDK versionv3.0.x
Was this page helpful?