ListIndexes()
This operation gets the index names of a collection.
Status ListIndexes(const ListIndexesRequest& request, ListIndexesResponse& response)
Request Syntax
auto request = ListIndexesRequest()
.WithDatabaseName(db_name)
.WithCollectionName(collection_name);
REQUEST METHODS:
WithDatabaseName(const std::string& db_name)Sets the target database name. The default database applies if it is empty.
WithCollectionName(const std::string& collection_name)Sets the name of the collection.
RETURNS:
Status with ListIndexesResponse
Check status.IsOk() to confirm success.
EXCEPTIONS:
StatusCode
Check
status.Code()andstatus.Message()for error details.
Example
#include "milvus/MilvusClientV2.h"
auto client = milvus::MilvusClientV2::Create();
milvus::ConnectParam connect_param{"http://localhost:19530", "root:Milvus"};
auto status = client->Connect(connect_param);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
milvus::ListIndexesResponse response;
status = client->ListIndexes(
milvus::ListIndexesRequest()
.WithCollectionName("my_collection"),
response);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
for (const auto& index_name : response.IndexNames()) {
std::cout << "Index: " << index_name << std::endl;
}