Execute a generic query on stored documents, returning Documents+other info.
The return value has a variable format, depending on whether the 'sort vector' is requested back from the server.
Only the n parameter is required. Omitting all other parameters results
in a query that matches each and every document found on the collection.
The method does not expose a projection directly, which is instead automatically determined based on the invocation options.
The returned Document objects are codec-independent.
arun_query(
self,
*,
n: int,
ids: list[str] | None = None,
filter: dict[str, Any] | None = None,
sort: dict[str, Any] | None = None,
include_similarity: bool | None = None,
include_sort_vector: bool = False,
include_embeddings: bool = False
) -> tuple[list[float] | None, AsyncIterable[AstraDBQueryResult]] | AsyncIterable[AstraDBQueryResult]| Name | Type | Description |
|---|---|---|
n* | int | amount of items to return. Fewer items than |
ids | list[str] | None | Default: Nonea list of document IDs to restrict the query to. If this is supplied, only document with an ID among the provided one will match. If further query filters are provided (i.e. metadata), matches must satisfy both requirements. |
filter | dict[str, Any] | None | Default: Nonea metadata filtering part. If provided, it must refer to
metadata keys by their bare name (such as
|
sort | dict[str, Any] | None | Default: Nonea 'sort' clause for the query, such as |
include_similarity | bool | None | Default: Nonewhether to return similarity scores with each match. Requires vector sort. |
include_sort_vector | bool | Default: Falsewhether to return the very query vector used for the ANN search alongside the iterable of results. Requires vector sort. Note that the shape of the return value depends on this parameter. |
include_embeddings | bool | Default: Falsewhether to retrieve the matches' own embedding vectors. |