Skip to main content

QdrantServerless

Struct QdrantServerless 

Source
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

Source

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()?;
Source

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.

Source

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.

Source

pub async fn delete_collection( &self, collection_name: impl Into<String>, ) -> Result<DeleteCollectionResult, QdrantError>

Deletes a collection and all of its data.

Source

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.

Source

pub async fn collection_exists( &self, collection_name: impl Into<String>, ) -> Result<bool, QdrantError>

Checks whether a collection exists.

Source

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.

Source

pub async fn query( &self, request: impl Into<QueryPoints>, ) -> Result<QueryResponse, QdrantError>

Query points in a collection.

Source

pub async fn query_batch( &self, request: impl Into<QueryBatchPoints>, ) -> Result<QueryBatchResponse, QdrantError>

Batch multiple point queries in a collection.

Source

pub async fn query_groups( &self, request: impl Into<QueryPointGroups>, ) -> Result<QueryGroupsResponse, QdrantError>

Query points and group results by a payload field.

Source

pub async fn get_points( &self, request: impl Into<GetPoints>, ) -> Result<GetResponse, QdrantError>

Retrieve points by IDs.

Source

pub async fn scroll( &self, request: impl Into<ScrollPoints>, ) -> Result<ScrollResponse, QdrantError>

Scroll over points, optionally filtered.

Source

pub async fn count( &self, request: impl Into<CountPoints>, ) -> Result<CountResponse, QdrantError>

Count points in a collection.

Source

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.

Source

pub async fn update_vectors( &self, request: impl Into<UpdatePointVectors>, ) -> Result<PointsOperationResponse, QdrantError>

Update vectors of existing points.

Source

pub async fn delete_vectors( &self, request: impl Into<DeletePointVectors>, ) -> Result<PointsOperationResponse, QdrantError>

Delete named vectors from points.

Source

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.

Source

pub async fn set_payload( &self, request: impl Into<SetPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>

Set (merge) payload on points.

Source

pub async fn overwrite_payload( &self, request: impl Into<SetPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>

Overwrite the entire payload of points.

Source

pub async fn delete_payload( &self, request: impl Into<DeletePayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>

Delete payload keys from points.

Source

pub async fn clear_payload( &self, request: impl Into<ClearPayloadPoints>, ) -> Result<PointsOperationResponse, QdrantError>

Clear the entire payload of points.

Source

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§

Source§

impl Clone for QdrantServerless

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more