Skip to main content

Method

To retrieve vectors from the index based on specific criteria, you can use the query method, which accepts the following parameters:
  • vector: The reference vector for similarity comparison.
  • include_metadata: A boolean flag indicating whether to include metadata in the query results.
  • include_vector: A boolean flag indicating whether to include vectors in the query results.
  • top_k: The number of top matching vectors to retrieve.
  • filter: Metadata filtering of the vector is used to query your data based on the filters and narrow down the query results.
As response, the object has the following fields:
  • id: The identifier associated with the matching vector.
  • metadata: Additional information or attributes linked to the matching vector.
  • score: A measure of similarity indicating how closely the vector matches the query vector. The score is normalized to the range [0, 1], where 1 indicates a perfect match.
  • vector: The vector itself (included only if include_vector is set to True).
If you wanna learn more about filtering check: Metadata Filtering

Query Example