Qdrant.Api.Http.Collections (Qdrant v0.1.18)

Copy Markdown View Source

Qdrant API Collections.

Collections are searchable collections of points.

Summary

Functions

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

collection_exists(collection_name)

@spec collection_exists(String.t()) :: Qdrant.Types.result(map())

collection_exists(client, collection_name, opts \\ [])

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}}}

create_collection(collection_name, body)

@spec create_collection(String.t(), Qdrant.Types.request_body()) ::
  Qdrant.Types.result(map())

create_collection(client, collection_name, body)

@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())

create_collection(client, collection_name, body, opts)

Create new collection with given parameters.

Parameters

  • collection_name - Name of the new collection
  • body - Collection configuration parameters (must include vectors key)
  • opts - Options, including :timeout in 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"}}

create_vector_name(collection_name, vector_name, body)

@spec create_vector_name(String.t(), String.t(), Qdrant.Types.request_body()) ::
  Qdrant.Types.result(map())

create_vector_name(client, collection_name, vector_name, body)

@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())

create_vector_name(client, collection_name, vector_name, body, opts)

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.

create_vector_name(collection_name, vector_name, body, wait, ordering, 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())

delete_collection(collection_name)

@spec delete_collection(String.t()) :: Qdrant.Types.result(map())

delete_collection(client, collection_name)

@spec delete_collection(Qdrant.Client.t(), String.t()) :: Qdrant.Types.result(map())
@spec delete_collection(String.t(), integer() | nil) :: Qdrant.Types.result(map())

delete_collection(client, collection_name, opts)

Drop collection and all associated data.

Parameters

  • collection_name - Name of the collection to delete
  • opts - Options, including :timeout in 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"}}

delete_vector_name(collection_name, vector_name)

@spec delete_vector_name(String.t(), String.t()) :: Qdrant.Types.result(map())

delete_vector_name(client, collection_name, vector_name)

@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())

delete_vector_name(client, collection_name, vector_name, opts)

@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.

delete_vector_name(collection_name, vector_name, wait, ordering, timeout)

@spec delete_vector_name(
  String.t(),
  String.t(),
  boolean() | nil,
  Qdrant.Types.ordering() | nil,
  integer() | nil
) :: Qdrant.Types.result(map())

get_collection(collection_name)

@spec get_collection(String.t()) :: Qdrant.Types.result(map())

get_collection(client, collection_name, opts \\ [])

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", ...}}}

get_collection_details(collection_name)

@spec get_collection_details(String.t()) :: Qdrant.Types.result(map())

get_collection_details(client, collection_name, opts \\ [])

@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", ...}}}

get_optimizations(collection_name)

@spec get_optimizations(String.t()) :: Qdrant.Types.result(map())

get_optimizations(client, collection_name)

@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())

get_optimizations(client, collection_name, opts)

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.

list_collections()

@spec list_collections() :: Qdrant.Types.result(map())

list_collections(client, opts \\ [])

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" => [...]}}}

update_collection(collection_name, body)

@spec update_collection(String.t(), Qdrant.Types.request_body()) ::
  Qdrant.Types.result(map())

update_collection(client, collection_name, body)

@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())

update_collection(client, collection_name, body, opts)

Update parameters of the existing collection.

Parameters

  • collection_name - Name of the collection to update
  • body - New collection parameters
  • opts - Options, including :timeout in 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"}}