Skip to main content

Connect for On-Demand Search

Use a project endpoint when you want to run on-demand search or query workloads with compute from an on-demand cluster.

Note

This page is for connecting to a project endpoint for on-demand search. If you want to connect to a Free, Serverless, or Dedicated serving cluster, see Connect to Serving Clusters.

Endpoint format​

Endpoint typeEndpoint patternUse for
Project endpointhttps://{project-id}.{region}.api.zillizcloud.comData import, batch search, query, get, search, and hybrid search through an on-demand cluster.

Before you begin​

  • Get the project endpoint from the Zilliz Cloud console.

  • Get the on-demand cluster ID that should provide compute resources for the search workload.

  • Create an API key with sufficient permissions for the project and target data.

  • Install a Milvus SDK for your use case. For details, refer to Install SDKs.

Connect to a Project Endpoint​

Create a MilvusClient with the project endpoint and specify the on-demand cluster that should serve the request.

python
from pymilvus import MilvusClient

client = MilvusClient(
uri="https://{project-id}.{region}.api.zillizcloud.com",
cluster="inxx-xxxxxxxxxxxxxxx",
token="YOUR_API_KEY",
)

Create a Search Session​

Use a session object to attach your operations to the on-demand cluster.

python
session = client.session(cluster_id="inxx-xxxxxxxxxxxxxxx")

Then use the session to run DQL operations such as query, get, search, and hybrid_search.

python
results = session.search(
collection_name="my_collection",
data=[[0.1, 0.2, 0.3, 0.4]],
anns_field="vector",
limit=10,
)

print(results)

Authentication​

When connecting to a project endpoint, use a valid API key as the authentication token.

Cluster credentials in username:password format are for serving cluster endpoints. For on-demand search through a project endpoint, use an API key with the required project permissions.

When to Use This Connection​

Use the project endpoint for batch processing, exploration, validation, experiments, and other workloads where on-demand compute is a better fit than always-on serving.

For production applications that require the full Collection API and always-on low-latency serving, connect to a Free, Serverless, or Dedicated serving cluster instead. See Connect to Serving Clusters for the serving cluster endpoint formats and connection examples.