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

Copy Markdown View Source

Qdrant API Collections.

Collections are searchable collections of points.

Summary

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

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

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

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