Connect for Lake-Search
Use a project endpoint when you want to run Search in Lake-Search or query workloads with compute from a Lake-Search cluster.
This page is for connecting to a project endpoint for Search in Lake-Search. If you want to connect to a Free, Serverless, or Dedicated vector database, see Connect to Serving Clusters.
Endpoint format
| Endpoint type | Endpoint pattern | Use for |
|---|---|---|
| Project endpoint | https://{project-id}.{region}.api.zillizcloud.com | Data import, batch search, query, get, search, and hybrid search through a Lake-Search cluster. |
Before you begin
-
Get the project endpoint from the Zilliz Cloud console.
-
Get the Lake-Search 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 Lake-Search cluster that should serve the request.
- Python
- Java
- Go
- Rust
- C++
- NodeJS
- CSharp
- cURL
from pymilvus import MilvusClient
client = MilvusClient(
uri="https://{project-id}.{region}.api.zillizcloud.com",
token="YOUR_API_KEY",
)
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.client.MilvusClientV2Session;
import io.milvus.v2.service.vector.request.SearchReq;
import io.milvus.v2.service.vector.request.data.FloatVec;
import io.milvus.v2.service.vector.response.SearchResp;
import java.util.Arrays;
import java.util.Collections;
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("https://{project-id}.{region}.api.zillizcloud.com")
.token("YOUR_API_KEY")
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
// Note: The Go SDK does not support project-endpoint connections with
// Lake-Search cluster routing as of client/v3.0.0. Use a serving-cluster
// endpoint with the Go SDK instead.
use milvus::v2::prelude::*;
let config = ConnectConfig::new()
.uri("https://{project-id}.{region}.api.zillizcloud.com")
.token("YOUR_API_KEY");
let client = ClientV2::new(&config).await?;
#include <iostream>
#include "milvus/MilvusClientV2.h"
#include <vector>
auto client = milvus::MilvusClientV2::Create();
auto status = client->Connect(milvus::ConnectParam("https://{project-id}.{region}.api.zillizcloud.com").WithToken("YOUR_API_KEY"));
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
import { MilvusClient } from "@zilliz/milvus2-sdk-node";
const client = new MilvusClient({
address: "https://{project-id}.{region}.api.zillizcloud.com",
token: "YOUR_API_KEY",
});
using Milvus.Client.V2;
using Milvus.Client.V2.Types;
// Note: milvus-sdk-csharp does not support project-endpoint connections with
// Lake-Search cluster routing as of v3.0.0. Use a serving-cluster endpoint with
// the C# SDK instead.
# Note: The RESTful API does not expose Lake-Search cluster routing.
# Connect to the project endpoint with the /v2/vectordb/* endpoints directly.
Create a Search Session
Use a session object to attach your operations to the Lake-Search cluster.
- Python
- Java
- Go
- Rust
- C++
- NodeJS
- CSharp
- cURL
session = client.session(cluster_id="inxx-xxxxxxxxxxxxxxx")
MilvusClientV2Session session = client.session("inxx-xxxxxxxxxxxxxxx");
// Note: Not yet supported in the Go SDK as of client/v3.0.0.
let session = client.session("inxx-xxxxxxxxxxxxxxx")?;
milvus::MilvusClientV2SessionPtr session;
status = client->Session("inxx-xxxxxxxxxxxxxxx", session);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
const session = client.session("inxx-xxxxxxxxxxxxxxx");
using Milvus.Client.V2;
// Note: session-based connections are not yet supported in milvus-sdk-csharp as of v3.0.0.
# Note: REST does not expose session objects or Lake-Search cluster routing.
Then use the session to run DQL operations such as query, get, search, and hybrid_search.
- Python
- Java
- Go
- Rust
- C++
- NodeJS
- CSharp
- cURL
results = session.search(
collection_name="my_collection",
data=[[0.1, 0.2, 0.3, 0.4]],
anns_field="vector",
limit=10,
)
print(results)
SearchReq searchReq = SearchReq.builder()
.collectionName("my_collection")
.data(Collections.singletonList(new FloatVec(Arrays.asList(0.1f, 0.2f, 0.3f, 0.4f))))
.annsField("vector")
.topK(10)
.build();
SearchResp results = session.search(searchReq);
System.out.println(results.getSearchResults());
// Note: Not yet supported in the Go SDK as of client/v3.0.0.
let results = session
.search(SearchRequest::builder()
.collection_name("my_collection")
.vector_field("vector")
.vectors(SearchVectors::Float(vec![vec![0.1, 0.2, 0.3, 0.4]]))
.limit(10)
.build()?)
.await?;
println!("{results:?}");
milvus::SearchRequest request;
request.WithCollectionName("my_collection").WithLimit(10).WithAnnsField("vector");
request.AddFloatVector(std::vector<float>{0.1f, 0.2f, 0.3f, 0.4f});
milvus::SearchResponse response;
status = session->Search(request, response);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
const results = await session.search({
collection_name: "my_collection",
vector: [0.1, 0.2, 0.3, 0.4],
anns_field: "vector",
limit: 10,
});
console.log(results);
using Milvus.Client.V2;
// Note: session-based connections are not yet supported in milvus-sdk-csharp as of v3.0.0.
# Note: REST does not expose session objects or Lake-Search cluster routing.
# Search an Lake-Search cluster via the /v2/vectordb/search endpoint on the project endpoint.
Authentication
When connecting to a project endpoint, use a valid API key as the authentication token.
Cluster credentials in username:password format are for vector database endpoints. For Search in Lake-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 Lake-Search 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 vector database instead. See Connect to Serving Clusters for the vector database endpoint formats and connection examples.