Create()

This operation creates a new MilvusClientV2 instance and returns it as a std::shared_ptr. It is a static factory method that performs no network communication; call Connect() on the returned instance to establish a connection.

static std::shared_ptr<MilvusClientV2> Create()

RETURNS:

std::shared_ptr

The newly created MilvusClientV2 client instance, as a std::shared_ptr, ready to be configured with Connect().

ERROR HANDLING:

  • std::exception

    Thrown when the client instance cannot be constructed. Create() only allocates the underlying implementation object and performs no network communication; for example, memory allocation failure may throw std::bad_alloc.

Example

Create a client instance, then connect it to the local Milvus server.

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;
}

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?