Skip to main content

dropIndex()

MilvusClient interface. This method drops an index of a field for the specified collection.

R<RpcStatus> dropIndex(DropIndexParam requestParam);

DropIndexParam

Use the DropIndexParam.Builder to construct a DropIndexParam object.

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

Methods of DropIndexParam.Builder:

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

The name of index which will be dropped. If no index name is specified, the default index name is empty string which means let the server determine it.

indexName: The name of the index.

build()

Construct a CreateAliasParam object.

N/A

The DropIndexParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<RpcStatus> 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 error message of the exception.

  • If the API succeeds, it returns R.Status.Success.

Example

import io.milvus.param.*;

DropIndexParam param = DropIndexParam.newBuilder()
.withCollectionName(COLLECTION_NAME)
.withIndexName("index1")
.build();
R<RpcStatus> response = client.dropIndex(param)
if (response.getStatus() != R.Status.Success.getCode()) {
System.out.println(response.getMessage());
}