- Fetch documents: Fetch documents by ID or by metadata filter.
- Fetch records by ID or by metadata: The same two options for a vector index.
Fetch documents
In an index with a document schema, fetch documents by ID or by metadata filter. A request specifies exactly one ofids or filter, and can name up to 1,000 IDs. include_fields selects which fields come back, and omitting it returns all of them.
Fetch documents by ID
To fetch specific documents, pass their IDs:Fetch documents by metadata
To fetch every document matching a metadata filter expression, pass afilter instead of ids:
pagination.next token. Pass it back as pagination_token to get the next page, and stop when the response has no pagination token. In the REST API, limit sets the page size.
Unlike a filtered update or delete, a filtered fetch accepts the text-match operators $match_phrase, $match_all, and $match_any on full-text fields, so you can fetch documents by their text without running a search.
For the full request and response schema, see Fetch documents.
Fetch records
In a vector index, fetch records by ID or by metadata filter.Fetch records by ID
To fetch records from a namespace based on their IDs, use thefetch operation with the following parameters:
namespace: The namespace containing the records to fetch. To use the default namespace, set this to"__default__".ids: The IDs of the records to fetch. Maximum of 1000.
For on-demand indexes, since vector values are retrieved from object storage, fetch operations may have increased latency. If you only need metadata or IDs, consider using the
query operation instead, with include_values left at its default of false. See Decrease latency for more details.Fetch records by metadata
To fetch records from a namespace based on their metadata values, use thefetch_by_metadata operation with the following parameters:
For example, the following code fetches 2 records with a
genre field set to Action/Adventure from the default namespace:
pagination object with a next token. When there are no more results, the response doesn’t include a pagination object.
Vector fetch limits
These limits apply to the Vectors API. For an index with a document schema, see Fetch documents.Fetch by ID limits
Fetch by metadata limits
To retrieve more than 10,000 matching records, paginate through results using the
paginationToken parameter. See Fetch records by metadata.