Method
To retrieve vectors from the index based on specific criteria, you can use thequery method, which accepts the following parameters:
vector: The reference vector for similarity comparison.sparse_vector: The sparse vector value to query.data: A string for text-based queries (mutually exclusive with vector).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.include_data: A boolean flag indicating whether to include data 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.namespace: The namespace to use. When not specified, the default namespace is used.weighting_strategy: Weighting strategy to be used for sparse vectors.fusion_algorithm: Fusion algorithm to use while fusing scores from hybrid vectors.query_mode: Query mode for hybrid indexes with Upstash-hosted embedding models.
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 ifinclude_vectoris set toTrue).sparse_vector: The sparse vector itself (included only ifinclude_vectoris set toTrue).data: Additional unstructured information linked to the matching vector.
If you wanna learn more about filtering check: Metadata Filtering