Synchronous Usage
Creating a Resumable Query
To create a resumable query, use theresumable_query
method of the Index
class:
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.max_idle
: The maximum idle time for the query in seconds.
Starting the Query
To start the query and get initial results:Fetching More Results
To fetch additional results:Stopping the Query
When you’re done with the query, stop it to release resources:Asynchronous Usage
For asynchronous operations, use the AsyncIndex class:Creating an Async Resumable Query
Starting the Async Query
Fetching More Results Asynchronously
Stopping the Async Query
Error Handling
After stopping a query, attempting to fetch more results or stop it again will raise aClientError
:
Remember to always stop your query when you’re done to release server-side
resources.