Sometimes, you’re not just searching for something—you know exactly which vector you want to retrieve.
In such cases, you can directly fetch specific vectors from your database.
Fetch#
Each record in Upstash Vector is assigned a unique ID, which you can use to retrieve a specific vector from your database.
Let's use the fetch() method to retrieve a vector from Upstash Vector.
The fetch() method returns a Upstash\Vector\VectorFetchResult object, which allows you to access the results of the query.
Fetch by ID prefix#
You can also use fetch() to get all vectors which their IDs match a defined prefix.