pub struct QdrantServerless { /* private fields */ }Expand description
Entry point to a Qdrant Serverless space.
In development — do not use yet. This client is experimental and unstable; the API may change without notice and is not ready for production or general use.
Point operations behave like in the regular Qdrant client, except that
parameters serverless does not support (read consistency, shard selection,
write ordering, filtered updates, cross-collection lookups) are cleared
before the request is sent. Collection management uses the simplified
serverless API: only the tenant-facing configuration is exposed; storage
internals (quantization, WAL, segments, …) are decided by the serverless
manager.
§Example
use qdrant_client::serverless::{
CollectionConfig, DenseVectorConfig, Distance, KeywordIndex, QdrantServerless,
};
use qdrant_client::qdrant::{PointStruct, QueryPointsBuilder, UpsertPointsBuilder};
use qdrant_client::Payload;
let client = QdrantServerless::from_url("https://serverless.example.cloud.qdrant.io")
.api_key("<your api key>")
.build()?;
client
.create_collection(
"my-collection",
CollectionConfig::new()
.dense_vector(DenseVectorConfig::new(4, Distance::Cosine))
.payload_index("color", KeywordIndex::new()),
)
.await?;
client
.upsert_points(UpsertPointsBuilder::new(
"my-collection",
vec![PointStruct::new(1, vec![0.1, 0.2, 0.3, 0.4], Payload::default())],
))
.await?;
client
.query(QueryPointsBuilder::new("my-collection").query(vec![0.1, 0.2, 0.3, 0.4]))
.await?;Implementations§
Source§impl QdrantServerless
impl QdrantServerless
Sourcepub fn from_url(url: &str) -> QdrantServerlessBuilder
pub fn from_url(url: &str) -> QdrantServerlessBuilder
Start configuring a serverless client from a base URL.
use qdrant_client::serverless::QdrantServerless;
let client = QdrantServerless::from_url("https://serverless.example.cloud.qdrant.io")
.api_key(std::env::var("QDRANT_API_KEY"))
.build()?;Sourcepub fn new(config: QdrantConfig) -> Result<Self, QdrantError>
pub fn new(config: QdrantConfig) -> Result<Self, QdrantError>
Create a serverless client from an existing config.
Compatibility checks are forced off. Prefer Self::from_url.
Source§impl QdrantServerless
§Collection operations
Simplified, tenant-facing collection management. Storage internals are not exposed.
impl QdrantServerless
§Collection operations
Simplified, tenant-facing collection management. Storage internals are not exposed.
Sourcepub async fn create_collection(
&self,
collection_name: impl Into<String>,
config: CollectionConfig,
) -> Result<CreateCollectionResult, QdrantError>
pub async fn create_collection( &self, collection_name: impl Into<String>, config: CollectionConfig, ) -> Result<CreateCollectionResult, QdrantError>
Creates a collection with the given tenant-facing configuration.
At least one dense or sparse vector is required. Unlike the regular client, no storage internals (quantization, WAL, segment number, …) can be configured: the serverless manager decides those.
Sourcepub async fn delete_collection(
&self,
collection_name: impl Into<String>,
) -> Result<DeleteCollectionResult, QdrantError>
pub async fn delete_collection( &self, collection_name: impl Into<String>, ) -> Result<DeleteCollectionResult, QdrantError>
Deletes a collection and all of its data.
Sourcepub async fn get_collection(
&self,
collection_name: impl Into<String>,
) -> Result<CollectionInfo, QdrantError>
pub async fn get_collection( &self, collection_name: impl Into<String>, ) -> Result<CollectionInfo, QdrantError>
Returns a collection’s configuration and stats.
Unlike the regular client, does not error if the collection is missing:
check the CollectionInfo::exists field of the result.
Sourcepub async fn collection_exists(
&self,
collection_name: impl Into<String>,
) -> Result<bool, QdrantError>
pub async fn collection_exists( &self, collection_name: impl Into<String>, ) -> Result<bool, QdrantError>
Checks whether a collection exists.
Sourcepub async fn list_collections(
&self,
request: impl Into<ListCollections>,
) -> Result<CollectionsList, QdrantError>
pub async fn list_collections( &self, request: impl Into<ListCollections>, ) -> Result<CollectionsList, QdrantError>
Lists a page of collections in the space.
Defaults to the server page size (20, max 100). Pass offset_token from a
previous response’s next_offset_token to fetch the next page.
let page = client
.list_collections(ListCollectionsBuilder::new().limit(50))
.await?;
if let Some(token) = page.next_offset_token {
let next = client
.list_collections(ListCollectionsBuilder::new().offset_token(token))
.await?;
}Source§impl QdrantServerless
§Point operations
Same semantics as the regular client, minus parameters serverless does not
support. Unsupported fields on the request (read_consistency,
shard_key_selector, ordering, lookup_from, with_lookup,
update_filter, update_mode) are cleared before the RPC.
impl QdrantServerless
§Point operations
Same semantics as the regular client, minus parameters serverless does not
support. Unsupported fields on the request (read_consistency,
shard_key_selector, ordering, lookup_from, with_lookup,
update_filter, update_mode) are cleared before the RPC.
Sourcepub async fn query(
&self,
request: impl Into<QueryPoints>,
) -> Result<QueryResponse, QdrantError>
pub async fn query( &self, request: impl Into<QueryPoints>, ) -> Result<QueryResponse, QdrantError>
Query points in a collection.
Sourcepub async fn query_batch(
&self,
request: impl Into<QueryBatchPoints>,
) -> Result<QueryBatchResponse, QdrantError>
pub async fn query_batch( &self, request: impl Into<QueryBatchPoints>, ) -> Result<QueryBatchResponse, QdrantError>
Batch multiple point queries in a collection.
Sourcepub async fn query_groups(
&self,
request: impl Into<QueryPointGroups>,
) -> Result<QueryGroupsResponse, QdrantError>
pub async fn query_groups( &self, request: impl Into<QueryPointGroups>, ) -> Result<QueryGroupsResponse, QdrantError>
Query points and group results by a payload field.
Sourcepub async fn get_points(
&self,
request: impl Into<GetPoints>,
) -> Result<GetResponse, QdrantError>
pub async fn get_points( &self, request: impl Into<GetPoints>, ) -> Result<GetResponse, QdrantError>
Retrieve points by IDs.
Sourcepub async fn scroll(
&self,
request: impl Into<ScrollPoints>,
) -> Result<ScrollResponse, QdrantError>
pub async fn scroll( &self, request: impl Into<ScrollPoints>, ) -> Result<ScrollResponse, QdrantError>
Scroll over points, optionally filtered.
Sourcepub async fn count(
&self,
request: impl Into<CountPoints>,
) -> Result<CountResponse, QdrantError>
pub async fn count( &self, request: impl Into<CountPoints>, ) -> Result<CountResponse, QdrantError>
Count points in a collection.
Sourcepub async fn upsert_points(
&self,
request: impl Into<UpsertPoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn upsert_points( &self, request: impl Into<UpsertPoints>, ) -> Result<PointsOperationResponse, QdrantError>
Insert or update points.
Clears ordering, shard_key_selector, update_filter, and update_mode.
Sourcepub async fn update_vectors(
&self,
request: impl Into<UpdatePointVectors>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn update_vectors( &self, request: impl Into<UpdatePointVectors>, ) -> Result<PointsOperationResponse, QdrantError>
Update vectors of existing points.
Sourcepub async fn delete_vectors(
&self,
request: impl Into<DeletePointVectors>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn delete_vectors( &self, request: impl Into<DeletePointVectors>, ) -> Result<PointsOperationResponse, QdrantError>
Delete named vectors from points.
Sourcepub async fn delete_points(
&self,
request: impl Into<DeletePoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn delete_points( &self, request: impl Into<DeletePoints>, ) -> Result<PointsOperationResponse, QdrantError>
Delete points by selector.
Prefer selecting by explicit IDs: serverless rejects filtered updates.
Sourcepub async fn set_payload(
&self,
request: impl Into<SetPayloadPoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn set_payload( &self, request: impl Into<SetPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>
Set (merge) payload on points.
Sourcepub async fn overwrite_payload(
&self,
request: impl Into<SetPayloadPoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn overwrite_payload( &self, request: impl Into<SetPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>
Overwrite the entire payload of points.
Sourcepub async fn delete_payload(
&self,
request: impl Into<DeletePayloadPoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn delete_payload( &self, request: impl Into<DeletePayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>
Delete payload keys from points.
Sourcepub async fn clear_payload(
&self,
request: impl Into<ClearPayloadPoints>,
) -> Result<PointsOperationResponse, QdrantError>
pub async fn clear_payload( &self, request: impl Into<ClearPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>
Clear the entire payload of points.
Sourcepub async fn batch_update_points(
&self,
request: impl Into<UpdateBatchPoints>,
) -> Result<UpdateBatchResponse, QdrantError>
pub async fn batch_update_points( &self, request: impl Into<UpdateBatchPoints>, ) -> Result<UpdateBatchResponse, QdrantError>
Batch point update operations.
Operations with filter-based selectors are rejected by the serverless service.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for QdrantServerless
impl !UnwindSafe for QdrantServerless
impl Freeze for QdrantServerless
impl Send for QdrantServerless
impl Sync for QdrantServerless
impl Unpin for QdrantServerless
impl UnsafeUnpin for QdrantServerless
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request