Qdrant API Collections.
Collections are searchable collections of points.
Summary
Functions
Check if collection exists.
Create new collection with given parameters.
Creates a named vector on an existing collection.
Drop collection and all associated data.
Deletes a named vector from an existing collection.
Get detailed information about specified existing collection.
Retrieves parameters from the specified collection.
Returns optimization progress for a collection.
Get list name of all existing collections.
Update parameters of the existing collection.
Functions
@spec collection_exists(String.t()) :: Qdrant.Types.result(map())
@spec collection_exists(Qdrant.Client.t(), String.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
Check if collection exists.
Parameters
collection_name- Name of the collection to check
Network example (not a doctest)
client = Qdrant.Client.new!()
Qdrant.Api.Http.Collections.collection_exists(client, "my_collection")
{:ok, %{"result" => %{"exists" => true}}}
@spec create_collection(String.t(), Qdrant.Types.request_body()) :: Qdrant.Types.result(map())
@spec create_collection(Qdrant.Client.t(), String.t(), Qdrant.Types.request_body()) :: Qdrant.Types.result(map())
@spec create_collection(String.t(), Qdrant.Types.request_body(), integer() | nil) :: Qdrant.Types.result(map())
@spec create_collection( Qdrant.Client.t(), String.t(), Qdrant.Types.request_body(), Qdrant.Types.request_options() ) :: Qdrant.Types.result(map())
Create new collection with given parameters.
Parameters
collection_name- Name of the new collectionbody- Collection configuration parameters (must includevectorskey)opts- Options, including:timeoutin seconds for operation commit
Network example (not a doctest)
client = Qdrant.Client.new!()
body = %{vectors: %{size: 128, distance: "Cosine"}}
Qdrant.Api.Http.Collections.create_collection(client, "my_collection", body)
{:ok, %{"result" => true, "status" => "ok"}}
@spec create_vector_name(String.t(), String.t(), Qdrant.Types.request_body()) :: Qdrant.Types.result(map())
@spec create_vector_name( Qdrant.Client.t(), String.t(), String.t(), Qdrant.Types.request_body() ) :: Qdrant.Types.result(map())
@spec create_vector_name( String.t(), String.t(), Qdrant.Types.request_body(), boolean() | nil ) :: Qdrant.Types.result(map())
@spec create_vector_name( Qdrant.Client.t(), String.t(), String.t(), Qdrant.Types.request_body(), Qdrant.Types.request_options() ) :: Qdrant.Types.result(map())
@spec create_vector_name( String.t(), String.t(), Qdrant.Types.request_body(), boolean() | nil, Qdrant.Types.ordering() | nil ) :: Qdrant.Types.result(map())
Creates a named vector on an existing collection.
The body contains either a dense vector configuration, such as
%{dense: %{size: 768, distance: "Cosine"}}, or a sparse configuration.
Options are :wait, :ordering, and :timeout.
@spec create_vector_name( String.t(), String.t(), Qdrant.Types.request_body(), boolean() | nil, Qdrant.Types.ordering() | nil, integer() | nil ) :: Qdrant.Types.result(map())
@spec delete_collection(String.t()) :: Qdrant.Types.result(map())
@spec delete_collection(Qdrant.Client.t(), String.t()) :: Qdrant.Types.result(map())
@spec delete_collection(String.t(), integer() | nil) :: Qdrant.Types.result(map())
@spec delete_collection(Qdrant.Client.t(), String.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
Drop collection and all associated data.
Parameters
collection_name- Name of the collection to deleteopts- Options, including:timeoutin seconds for operation commit
Network example (not a doctest)
client = Qdrant.Client.new!()
Qdrant.Api.Http.Collections.delete_collection(client, "my_collection")
{:ok, %{"result" => true, "status" => "ok"}}
@spec delete_vector_name(String.t(), String.t()) :: Qdrant.Types.result(map())
@spec delete_vector_name(Qdrant.Client.t(), String.t(), String.t()) :: Qdrant.Types.result(map())
@spec delete_vector_name(String.t(), String.t(), boolean() | nil) :: Qdrant.Types.result(map())
@spec delete_vector_name( Qdrant.Client.t(), String.t(), String.t(), Qdrant.Types.request_options() ) :: Qdrant.Types.result(map())
@spec delete_vector_name( String.t(), String.t(), boolean() | nil, Qdrant.Types.ordering() | nil ) :: Qdrant.Types.result(map())
Deletes a named vector from an existing collection.
@spec delete_vector_name( String.t(), String.t(), boolean() | nil, Qdrant.Types.ordering() | nil, integer() | nil ) :: Qdrant.Types.result(map())
@spec get_collection(String.t()) :: Qdrant.Types.result(map())
@spec get_collection(Qdrant.Client.t(), String.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
Get detailed information about specified existing collection.
Parameters
collection_name- The name of the collection to retrieve information from.
Network example (not a doctest)
client = Qdrant.Client.new!()
Qdrant.Api.Http.Collections.get_collection(client, "my_collection")
{:ok, %{"result" => %{"name" => "my_collection", ...}}}
@spec get_collection_details(String.t()) :: Qdrant.Types.result(map())
@spec get_collection_details( Qdrant.Client.t(), String.t(), Qdrant.Types.request_options() ) :: Qdrant.Types.result(map())
Retrieves parameters from the specified collection.
Alias for get_collection/1 for backward compatibility.
Parameters
collection_name- The name of the collection to retrieve parameters from.
Network example (not a doctest)
client = Qdrant.Client.new!()
Qdrant.Api.Http.Collections.get_collection_details(client, "my_collection")
{:ok, %{"result" => %{"name" => "my_collection", ...}}}
@spec get_optimizations(String.t()) :: Qdrant.Types.result(map())
@spec get_optimizations(Qdrant.Client.t(), String.t()) :: Qdrant.Types.result(map())
@spec get_optimizations(String.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
@spec get_optimizations(Qdrant.Client.t(), String.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
Returns optimization progress for a collection.
:with accepts a comma-separated string or a list containing :queued,
:completed, and :idle_segments. :completed_limit limits completed
optimizations returned by Qdrant.
@spec list_collections() :: Qdrant.Types.result(map())
@spec list_collections(Qdrant.Client.t(), Qdrant.Types.request_options()) :: Qdrant.Types.result(map())
Get list name of all existing collections.
Network example (not a doctest)
client = Qdrant.Client.new!()
Qdrant.Api.Http.Collections.list_collections(client)
{:ok, %{"result" => %{"collections" => [...]}}}
@spec update_collection(String.t(), Qdrant.Types.request_body()) :: Qdrant.Types.result(map())
@spec update_collection(Qdrant.Client.t(), String.t(), Qdrant.Types.request_body()) :: Qdrant.Types.result(map())
@spec update_collection(String.t(), Qdrant.Types.request_body(), integer() | nil) :: Qdrant.Types.result(map())
@spec update_collection( Qdrant.Client.t(), String.t(), Qdrant.Types.request_body(), Qdrant.Types.request_options() ) :: Qdrant.Types.result(map())
Update parameters of the existing collection.
Parameters
collection_name- Name of the collection to updatebody- New collection parametersopts- Options, including:timeoutin seconds for operation commit
Network example (not a doctest)
client = Qdrant.Client.new!()
body = %{optimizers_config: %{deleted_threshold: 0.2}}
Qdrant.Api.Http.Collections.update_collection(client, "my_collection", body)
{:ok, %{"result" => true, "status" => "ok"}}