Creates a new vectorize index with the specified parameters.
The parameters for creating the vectorize index, including:
name
: The name of the index.description
: A description of the index.config
: Configuration options for the index.A promise that resolves to the response of the create vectorize index operation.
Deletes a vectorize index by its name.
The parameters containing the index name to delete.
A promise that resolves with the response of the delete operation.
Deletes vectors from the specified index by their identifiers.
The parameters for deleting vectors by identifier.
The name of the index from which to delete vectors.
An array of vector identifiers to delete.
A promise that resolves to the response of the delete operation.
Retrieves information about a specific vectorize index.
The parameters required to get the vectorize index, including the index name.
A promise that resolves to the response containing details of the vectorize index.
Retrieves detailed information about a vectorize index.
The parameters containing the index name.
The response from the API.
Retrieves vectors from the specified index by their unique identifiers.
The parameters for fetching vectors by identifier.
The name of the index to query.
An array of unique identifiers for the vectors to retrieve.
A promise that resolves to the response containing the requested vectors.
Inserts vectors into a specified index in the Cloudflare Vectorize service.
The parameters for inserting vectors.
The name of the index to insert vectors into.
The NDJSON string containing the vectors to insert.
Optional behavior for handling unparsable vectors.
A promise that resolves to the response of the insert operation.
Queries a vector index with the provided vector and optional filters.
The parameters for querying vectors.
The name of the vector index to query.
The query vector to search with.
Optional filter to apply to the query.
Specifies the metadata to return ("none" by default).
Optional flag to indicate if vector values should be returned.
The number of top results to return.
A promise that resolves to the query response containing matched vectors and metadata.
Converts an array of objects into an NDJSON (Newline Delimited JSON) string.
Each object in the input array is serialized to a JSON string and separated by a newline character.
An array of objects to be converted to NDJSON format.
A string representing the NDJSON serialization of the input objects.
Upserts vectors into the specified index.
Sends a POST request to the {indexName}/upsert
endpoint with NDJSON data.
Optionally handles unparsable vectors according to the provided behavior.
The parameters for upserting vectors.
The name of the index to upsert vectors into.
The NDJSON string containing vector data.
Optional behavior for handling unparsable vectors.
A promise that resolves to the upsert vectors response.
Provides a TypeScript client for interacting with the Cloudflare Vectorize API.
The
Vectorize
class enables management and querying of vector indexes, including creating, deleting, listing, and updating indexes, as well as inserting, upserting, deleting, and querying vectors within those indexes.Authentication is handled via Cloudflare API credentials (API key or token).
Example
Remarks