Flutter: createIndex

Creates a new vector index in the scoped bucket. dimension is the length of the vectors the index will store and distanceMetric is the metric used for similarity queries. Keys listed in nonFilterableMetadataKeys can be stored on vectors but not used in query filters. dataType defaults to VectorDataType.float32.

Examples

Create an index

final bucket = supabase.storage.vectors.from('embeddings');

await bucket.createIndex(
  name: 'documents',
  dimension: 3,
  distanceMetric: DistanceMetric.cosine,
);

Create an index with non-filterable metadata

final bucket = supabase.storage.vectors.from('embeddings');

await bucket.createIndex(
  name: 'documents',
  dimension: 3,
  distanceMetric: DistanceMetric.euclidean,
  nonFilterableMetadataKeys: ['rawText'],
);