メインコンテンツまでスキップ

dropCollection()

Addedv2.3.xModifiedv2.6.x

This operation drops a collection.

public void dropCollection(DropCollectionReq request)

Request Syntax

dropCollection(DropCollectionReq.builder()
.databaseName(String databaseName)
.collectionName(String collectionName)
.async(Boolean async)
.timeout(Long timeout)
.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.

  • async(Boolean async) -

    Whether to run the operation asynchronously.

  • timeout(Long timeout) -

    The timeout duration in milliseconds.

RETURNS:

void

EXCEPTIONS:

  • MilvusClientException

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

Example

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.service.collection.request.DropCollectionReq;

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

MilvusClientV2 client = new MilvusClientV2(connectConfig);

// drop a collection: test
DropCollectionReq dropCollectionReq = DropCollectionReq.builder()
.collectionName("test")
.build();
client.dropCollection(dropCollectionReq);