SurrealDB icon

SurrealDB

Interaction with a SurrealDB database

Index → Rebuild Index

AI-generated

Summary

Rebuild an existing index on a specified table in SurrealDB, optionally conditioned on the index's existence.

Inputs

  • Table (required) — Specify the name of the table that the index to be rebuilt belongs to.
  • Index Name (required) — Provide the name of the index to rebuild.
  • Options — Customize the rebuild behavior with optional flags such as 'If Exists' to only rebuild if the index exists, and override namespace and database settings as needed.

Output shape

A single result object indicating the success or failure of the rebuild index operation for each input item.

The output reflects the SurrealDB response from the rebuild index command. If the 'If Exists' option is used, the command will execute conditionally based on index existence to avoid errors.

Examples

Example 1: To rebuild an existing index named 'user_email_idx' on the 'users' table, configure the 'Table' parameter as 'users' and 'Index Name' as 'user_email_idx'. Use the 'If Exists' option to ensure the operation only runs if the index is present, preventing errors if the index is missing.

  • Table: users
  • Index Name: user_email_idx
  • Options: If Exists = true

Links

Discussion