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

MilvusClient

Addedv2.3.xModifiedv3.0.x

A MilvusClient instance represents a Python client that connects to a specific Zilliz Cloud cluster.

pymilvus.MilvusClient

Constructor

Constructs a client for common use cases.

📘Notes

This client serves as an easy-to-use alternative for the current set of APIs that handles Create, Read, Update, and Delete (CRUD) operations on Zilliz Cloud.

MilvusClient(
uri: str,
user: str,
password: str,
db_name: str,
token: str,
timeout=None,
**kwargs
)

PARAMETERS:

  • uri (string) -

    The URI of the Zilliz Cloud cluster. For example:

    • Cluster endpoint

      • Free & Serverless

        <i>http</i>s://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com

      • Dedicated

        <i>http</i>s://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

    • Project endpoint (On-demand)

      <i>http</i>s://{project-id}.{region}.api.zillizcloud.com

  • user (string) -

    A valid username used to connect to the specified Zilliz Cloud cluster.

    This should be used along with password.

  • password (string) -

    A valid password used to connect to the specified Zilliz Cloud cluster.

    This should be used along with user.

  • db_name (string) -

    The name of the database to which the target Milvus instance belongs.

  • token (string) -

    A valid access token to access the specified Zilliz Cloud cluster.

    This can be used as a recommended alternative to setting user and password separately.

    When setting this field, notice that:

    A valid token should be either

    • An API key with sufficient permissions, or

    • A pair of username and password used to access the target cluster, joined by a colon (:). For example, you can set this to username:p@ssw0rd. This applies only when you use a cluster endpoint.

  • timeout (float | None)

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

Examples

from pymilvus import MilvusClient

# Authentication enabled with a cluster user
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password", # replace this with your token,
db_name="default"
)
📘Notes

Set uri to your cluster endpoint. The token parameter can be a Zilliz Cloud API key with sufficient permissions or the credentials of a cluster user in the format of username:p@ssw0rd.