SurrealDB icon

SurrealDB

Interaction with a SurrealDB database

Index → Create Index

AI-generated

Summary

Create an index on a specified table in SurrealDB, supporting different index types (standard B-Tree, full-text search, or vector MTREE) with various configuration options.

Inputs

  • Table (required) — Name of the table where the index will be created.
  • Index Name (required) — Name of the index to be created.
  • Index Fields (required) — Comma-separated fields defining which columns to index.
  • Index Type (required) — The type of index to create; options include standard (B-Tree), full-text search, or vector (MTREE).
  • Vector Dimension — Dimensionality of the vector data when creating an MTREE index; required if index type is MTREE.
  • Distance Function — Distance function for vector similarity searches when using MTREE index type (euclidean, manhattan, cosine).
  • FTS Analyzer — Text analyzer to use for full-text search indexes (must be defined in SurrealDB); applicable only for full-text search index type.
  • Enable Highlights — Whether to enable highlighting in full-text search results; applicable only for full-text search index type.
  • Is Unique — Whether the index enforces unique values.
  • Create Concurrently — Whether to build the index concurrently in the background without blocking writes.
  • If Not Exists — Create the index only if it does not already exist.
  • Overwrite — Overwrite the index if it already exists.
  • Vector Type — Data type for storing vector components in MTREE index (float 32, float 64, or int 64).
  • Namespace — Optional namespace override for this operation.
  • Database — Optional database override for this operation.

Output shape

a single record containing the operation result or status

The response includes details about the created index or error information. Options like 'ifNotExists' and 'overwrite' control behavior when the index already exists. Optional namespace and database overrides apply if specified.

Links

Discussion