< Docs
  • Java


MilvusClient interface. This method alters an index with key-value properties.

R<RpcStatus> alterIndex(AlterIndexParam requestParam);


Use the AlterIndexParam.Builder to construct an AlterIndexParam object.

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

Methods of AlterIndexParam.Builder:

Method Description Parameters
withCollectionName(collectionName) Set the collection name. Collection name cannot be empty or null. collectionName: The target collection name.
withIndexName(String indexName) Set the target index name. 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 AlterIndexParam 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<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.


import io.milvus.param.*;

AlterIndexParam param = AlterIndexParam.newBuilder()
R<RpcStatus> response = client.alterIndex(param);
if (response.getStatus() != R.Status.Success.getCode()) {