Skip to content

VectorizeMetadataIndex

Source: src/Cloudflare/Vectorize/VectorizeMetadataIndex.ts

A metadata index on a Cloudflare Vectorize index.

Metadata indexes enable filtering query results by metadata properties. Without a metadata index on a property, that property cannot be used in the filter of a query() call.

A metadata index is identified by its parent index and propertyName and is immutable — changing the property name, type, or parent index triggers a replacement.

Index a string metadata property

const index = yield* Cloudflare.VectorizeIndex("my-index", {
dimensions: 768,
metric: "cosine",
});
yield* Cloudflare.VectorizeMetadataIndex("CategoryMetaIndex", {
indexName: index.indexName,
propertyName: "category",
indexType: "string",
});

Index a numeric metadata property

yield* Cloudflare.VectorizeMetadataIndex("PriceMetaIndex", {
indexName: index.indexName,
propertyName: "price",
indexType: "number",
});