create
Create a new Vectorize index.The name of the Vectorize index to create (must be unique)
Configuration Options
You must provide either a preset OR both dimensions and metric:The name of a preset representing an embeddings model. Vectorize will configure the dimensions and distance metric for you.Valid values:
@cf/baai/bge-small-en-v1.5@cf/baai/bge-base-en-v1.5@cf/baai/bge-large-en-v1.5openai/text-embedding-ada-002cohere/embed-multilingual-v2.0
The dimension size to configure this index for, based on the output dimensions of your ML model
The distance metric to use for searching within the index.Valid values:
euclidean, cosine, dot-productAn optional description for this index
Output Options
Return output as clean JSON
Worker Binding Options
The binding name of this resource in your Worker
Automatically update your config file with the newly added resource
Examples
Using a preset
Using custom dimensions and metric
With description
delete
Delete a Vectorize index.The name of the Vectorize index to delete
Options
Skip confirmation (alias:
-y)Example
list
List all Vectorize indexes in your account.Options
Return output as clean JSON
Example
- Index name
- Dimensions
- Distance metric
- Description
- Created date
- Modified date
get
Get details about a specific Vectorize index.The name of the Vectorize index
Options
Return output as clean JSON
Example
info
Get additional details about an index including vector count and processing status.The name of the Vectorize index
Options
Return output as clean JSON
Example
- Dimensions
- Vector count
- Processed up to mutation ID
- Processed up to datetime
insert
Insert vectors into a Vectorize index from a file.The name of the Vectorize index
Options
A file containing line separated JSON (ndjson) vector objects
Number of vector records to include when sending to the Cloudflare API
Return output as clean JSON
Example
Vector File Format
The file should be in NDJSON format (newline-delimited JSON), with each line containing a vector object:Insert operations are enqueued and processed asynchronously. Use the mutation ID returned to track processing status.
upsert
Upsert (insert or update) vectors into a Vectorize index from a file.The name of the Vectorize index
Options
A file containing line separated JSON (ndjson) vector objects
Number of vector records to include in a single upsert batch when sending to the Cloudflare API
Return output as clean JSON
Example
query
Query a Vectorize index to find similar vectors.The name of the Vectorize index
Query Input Options
You must provide either--vector OR --vector-id (but not both):
Vector values to query the index with. Provide as space-separated numbers.
Identifier for a vector in the index against which the index should be queried
Query Options
The number of results (nearest neighbors) to return
Specify if the vector values should be included in the results
Specify if the vector metadata should be included in the results.Valid values:
all, indexed, noneFilter the query results based on this namespace
Filter the query results based on metadata. Provide as a JSON string.
Examples
Query by vector
Query by vector ID
Query with metadata
Query from file
Query with filter
get-by-ids
Get specific vectors from an index by their IDs.The name of the Vectorize index
Options
Vector identifiers to fetch from the index. Provide as space-separated values.
Example
delete-by-ids
Delete specific vectors from an index by their IDs.The name of the Vectorize index
Options
Vector identifiers to delete from the index. Provide as space-separated values.
Example
Delete operations are enqueued and processed asynchronously. Use the mutation ID returned to track processing status.
Metadata Indexes
Metadata indexes enable efficient filtering on vector metadata properties.create-metadata-index
create-metadata-index
list-metadata-index
list-metadata-index
delete-metadata-index
delete-metadata-index
Configuration
Add a Vectorize index to your Worker:wrangler.json
Metadata Filtering
When querying vectors, you can filter results based on metadata:Basic Equality
Comparison Operators
$eq- equals$ne- not equals$lt- less than$lte- less than or equal$gt- greater than$gte- greater than or equal
Array Operators
Nested Properties
Rate Limits and Batch Processing
- Insert/Upsert operations are limited to 5,000 vectors per batch by default
- Total upload limit during beta: 100,000 vectors per run
- Operations are processed asynchronously - use mutation IDs to track progress
- The global Cloudflare API rate limit is 1,200 requests per 5 minutes
Best Practices
-
Choose the right metric: Use
cosinefor normalized vectors,euclideanfor absolute distances, anddot-productfor similarity scores. - Index metadata selectively: Only create metadata indexes for properties you’ll filter on frequently.
- Batch operations: Use larger batch sizes (up to 5,000) for better performance when inserting many vectors.
- Use presets when possible: Presets automatically configure optimal settings for popular embedding models.
- Monitor mutations: Track mutation IDs to ensure your insert/upsert/delete operations complete successfully.