View Source Qdrant.Api.Http.Points (Qdrant v0.0.8)

Qdrant API Points. Float-point vectors with payload.

Points are the main data structure in Qdrant. Each point is a vector of floats, that is associated with an ID and a payload. Qdrant allows to perform search operations on points, and also to store arbitrary JSON payloads with each point. Points are stored in collections, and each collection has its own set of vectors.

Link to this section Summary

Functions

Count points which matches given filtering condition

Retrieve full information of single point by id.

Retrieve multiple points by specified IDs.

Look for the points which are closer to stored positive examples and at the same time further to negative examples.

Request points based on positive and negative examples.

Scroll request - paginate over all points which matches given filtering condition

Retrieve closest points based on vector similarity and given filtering conditions

Retrieve by batch the closest points based on vector similarity and given filtering conditions

Perform insert + updates on points. If point with given ID already exists - it will be overwritten. See more on qdrant

Link to this section Types

@type consistency() :: non_neg_integer() | :majority | :quorum | :all
@type delete_body() ::
  %{points: [non_neg_integer() | String.t()]}
  | %{
      filter: %{
        must: filter_type(),
        should: filter_type(),
        must_not: filter_type()
      }
    }
@type delete_payload_body() :: %{
  keys: [String.t()],
  points: extended_point_id(),
  filter: filter_type()
}
@type extended_point_id() :: [non_neg_integer() | String.t()]
@type field_condition() :: %{
  key: String.t(),
  match: %{value: String.t()} | %{text: String.t()} | %{any: String.t()},
  range: %{gte: float(), lte: float(), gt: float(), lt: float()},
  geo_bounding_box: %{
    top_left: %{lat: float(), lon: float()},
    bottom_right: %{lat: float(), lon: float()}
  },
  geo_radius: %{center: %{lat: float(), lon: float()}, radius: float()},
  values_count: %{
    lt: non_neg_integer(),
    lte: non_neg_integer(),
    gt: non_neg_integer(),
    gte: non_neg_integer()
  }
}
@type filter_type() ::
  [field_condition()] | %{is_empty: map()} | %{has_id: extended_point_id()}
@type get_points_body() :: %{
  ids: [non_neg_integer() | String.t()],
  with_payload: with_payload_interface(),
  with_vector: boolean() | [String.t()]
}
@type hnsw_config() :: %{
  m: non_neg_integer() | nil,
  ef_construct: non_neg_integer() | nil,
  full_scan_threshold: non_neg_integer() | nil,
  max_indexing_threads: non_neg_integer() | nil,
  on_disk: boolean() | nil,
  payload_m: non_neg_integer() | nil
}
@type optimizers_config() :: %{
  deleted_threshold: float() | nil,
  vacuum_min_vector_number: non_neg_integer() | nil,
  default_segment_number: non_neg_integer() | nil,
  max_segment_size: non_neg_integer() | nil,
  memmap_threshold: non_neg_integer() | nil,
  indexing_threshold: non_neg_integer() | nil,
  flush_interval_sec: non_neg_integer() | nil,
  max_optimization_threads: pos_integer() | nil
}
@type ordering() :: :weak | :medium | :strong
@type point() :: %{
  id: non_neg_integer() | String.t(),
  vector: [float()],
  payload: map()
}
@type points_batch() :: %{
  batch: %{
    ids: [non_neg_integer() | String.t()],
    vectors: vectors(),
    payloads: [map()]
  }
}
@type points_list() :: %{points: [point()]}
@type quantization_config() :: %{
  scalar: %{type: String.t(), quantile: float(), always_ram: boolean()}
}
Link to this type

recommend_batch_body()

View Source
@type recommend_batch_body() :: [recommend_body()]
@type recommend_body() :: %{
  positive: extended_point_id(),
  negative: extended_point_id(),
  filter: filter_type(),
  params: search_params(),
  limit: non_neg_integer(),
  offset: non_neg_integer(),
  with_payload: with_payload_interface(),
  with_vector: boolean() | [String.t()],
  score_threshold: non_neg_integer() | nil,
  using: String.t(),
  lookup_from: %{collection: String.t(), vector: String.t()} | nil
}
@type scroll_body() :: %{
  offset: non_neg_integer() | String.t(),
  limit: non_neg_integer(),
  filter: filter_type(),
  with_payload: with_payload_interface(),
  with_vector: boolean() | [String.t()]
}
@type search_batch_body() :: [search_request()]
@type search_body() :: %{
  vector: vector(),
  filter:
    %{must: filter_type(), should: filter_type(), must_not: filter_type()} | nil,
  params: search_params(),
  limit: integer(),
  offset: non_neg_integer(),
  with_payload: with_payload_interface(),
  with_vector: boolean() | [String.t()],
  score_threshold: integer() | nil
}
@type search_params() :: %{
  hnsw_ef: integer() | nil,
  exact: boolean(),
  quantization: %{ignore: boolean() | false, rescore: boolean() | false} | nil
}
@type search_request() :: %{
  vector: vector(),
  filter: filter_type(),
  params: search_params(),
  limit: non_neg_integer(),
  offset: non_neg_integer(),
  with_payload: with_payload_interface(),
  with_vector: boolean() | [String.t()],
  score_threshold: integer() | nil
}
@type set_payload_body() :: %{
  payload: map(),
  points: extended_point_id(),
  filter: filter_type()
}
@type upsert_body() :: points_batch() | points_list()
@type vector() :: [float()] | %{name: String.t(), vector: [float()]}
@type vectors() :: [vector()]
Link to this type

with_payload_interface()

View Source
@type with_payload_interface() ::
  boolean() | [String.t()] | %{include: String.t(), exclude: String.t()}

Link to this section Functions

Link to this function

clear_payload(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec clear_payload(
  String.t(),
  [integer() | String.t()],
  boolean() | nil,
  ordering() | nil
) ::
  {:ok, map()} | {:error, any()}

Remove all payload for specified points

path-parameters

Path parameters

  • collection_name required : Name of the collection to clear payload from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • points required : List of points to clear payload from
Link to this function

count_points(collection_name, body)

View Source
@spec count_points(String.t(), %{filter: filter_type(), exact: boolean()}) ::
  {:ok, map()} | {:error, any()}

Count points which matches given filtering condition

path-parameters

Path parameters

  • collection_name required : Name of the collection to count in

request-body-schema

Request body schema

  • filter optional : Filter to apply to the search results. Look only for points which satisfies this conditions

  • exact optional : If true, count exact number of points. If false, count approximate number of points faster. Approximate count might be unreliable during the indexing process. Default: true

Link to this function

delete_payload(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec delete_payload(
  String.t(),
  delete_payload_body(),
  boolean() | nil,
  ordering() | nil
) ::
  {:ok, map()} | {:error, any()}

Delete specified key payload for points

path-parameters

Path parameters

  • collection_name required : Name of the collection to delete from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • keys required : List of payload keys to remove from payload

  • points required : Deletes values from each point in this list

  • filter optional : Deletes values from points that satisfy this filter condition

Link to this function

delete_points(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec delete_points(String.t(), delete_body(), boolean() | nil, ordering() | nil) ::
  {:ok, map()} | {:error, any()}

Delete points

path-parameters

Path parameters

  • collection_name required : Name of the collection to update from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • points required : List of points to delete
Link to this function

get_point(collection_name, id, consistency \\ nil)

View Source
@spec get_point(String.t(), String.t() | non_neg_integer(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Retrieve full information of single point by id.

path-parameters

Path parameters

  • collection_name required : Name of the collection to update from

  • id required : ID of the point to retrieve

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation
Link to this function

get_points(collection_name, body, consistency \\ nil)

View Source
@spec get_points(String.t(), get_points_body(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Retrieve multiple points by specified IDs.

path-parameters

Path parameters

  • collection_name required : Name of the collection to update from

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • ids required : List of IDs to retrieve
  • with_payload optional : Select which payload to return with the response. Default: All
  • with_vector optional : Options for specifying which vector to include
Link to this function

overwrite_payload(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec overwrite_payload(
  String.t(),
  set_payload_body(),
  boolean() | nil,
  ordering() | nil
) ::
  {:ok, map()} | {:error, any()}

Replace full payload of points with new one

path-parameters

Path parameters

  • collection_name required : Name of the collection to set from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • payload required : Payload to set

  • points required : Assigns payload to each point in this list

  • filter optional : Assigns payload to each point that satisfy this filter condition

Link to this function

recommend_points(collection_name, body, consistency \\ nil)

View Source
@spec recommend_points(String.t(), recommend_body(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Look for the points which are closer to stored positive examples and at the same time further to negative examples.

path-parameters

Path parameters

  • collection_name required : Name of the collection to search in

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • positive required : Look for vectors closest to those

  • negative required : Look for vectors further from those | Try to avoid vectors like this

  • filter optional : Look only for points which satisfies this conditions

  • params optional : Additional search parameters

  • limit required : Maximum number of points to return

  • offset optional : Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues.

  • with_payload optional : Select which payload to return with the response. Default: None

  • with_vector optional : Whether to return the point vector with the result?

  • score_threshold optional : Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.

  • using optional : Define which vector to use for recommendation, if not specified - try to use default vector

  • lookup_from optional : The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection

Link to this function

recommend_points_batch(collection_name, body, consistency \\ nil)

View Source
@spec recommend_points_batch(String.t(), recommend_batch_body(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Request points based on positive and negative examples.

path-parameters

Path parameters

  • collection_name required : Name of the collection to search in

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • searches required : List of searches to perform
Link to this function

scroll_points(collection_name, body, consistency \\ nil)

View Source
@spec scroll_points(String.t(), scroll_body(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Scroll request - paginate over all points which matches given filtering condition

path-parameters

Path parameters

  • collection_name required : Name of the collection to retrieve from

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • offset optional : Start ID to read points from.

  • limit optional : Page size. Default: 10

  • filter optional : Look only for points which satisfies this conditions. If not provided - all points.

  • with_payload optional : Select which payload to return with the response. Default: All

  • with_vector optional : Options for specifying which vector to include

Link to this function

search_points(collection_name, body, consistency \\ nil)

View Source
@spec search_points(String.t(), search_body(), integer() | nil) ::
  {:ok, map()} | {:error, any()}

Retrieve closest points based on vector similarity and given filtering conditions

path-parameters

Path parameters

  • collection_name required : Name of the collection to search in

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • vector required : Vector to search for

  • filter optional : Filter to apply to the search results. Look only for points which satisfies this conditions

  • params optional : Additional search parameters

  • limit required : Maximum number of points to return

  • offset optional : Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues.

  • with_payload optional : Select which payload to return with the response. Default: None

  • with_vector optional : Whether to return the point vector with the result?

  • score_threshold optional : Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.

Link to this function

search_points_batch(collection_name, body, consistency \\ nil)

View Source
@spec search_points_batch(String.t(), search_batch_body(), consistency() | nil) ::
  {:ok, map()} | {:error, any()}

Retrieve by batch the closest points based on vector similarity and given filtering conditions

path-parameters

Path parameters

  • collection_name required : Name of the collection to search in

query-parameters

Query parameters

  • consistency optional : Define read consistency guarantees for the operation

request-body-schema

Request body schema

  • searches required : List of searches to perform
Link to this function

set_payload(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec set_payload(String.t(), set_payload_body(), boolean() | nil, ordering() | nil) ::
  {:ok, map()} | {:error, any()}

Set payload values for points

path-parameters

Path parameters

  • collection_name required : Name of the collection to set from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • payload required : Payload to set

  • points required : Assigns payload to each point in this list

  • filter optional : Assigns payload to each point that satisfy this filter condition

Link to this function

upsert_points(collection_name, body, wait \\ false, ordering \\ nil)

View Source
@spec upsert_points(String.t(), upsert_body(), boolean() | nil, ordering() | nil) ::
  {:ok, map()} | {:error, any()}

Perform insert + updates on points. If point with given ID already exists - it will be overwritten. See more on qdrant

path-parameters

Path parameters

  • collection_name required : Name of the collection to update from

query-parameters

Query parameters

  • wait optional : If true, wait for changes to actually happen

  • ordering optional : Define ordering guarantees for the operation

request-body-schema

Request body schema

  • batch required : List of points to insert or update OR
  • points required : Point to insert or update