Search & metadata

Reindex Typesense

Load an existing database into a new Typesense instance.

Reindexing is typically needed after deploying a fresh Typesense instance, migrating to a new Typesense cluster, or recovering from Typesense data loss while your primary database remains intact.

In this scenario, Typesense is empty while your primary database holds transactions, balances, ledgers, and identities. Reindexing populates Typesense with all existing records so search works correctly.

How it works

Trigger the reindex

Blnk reads all records from your database and indexes them into their respective Typesense collections (transactions, balances, ledgers, identities).

curl -X POST "http://localhost:5001/search/reindex" \
  -H "X-blnk-key: <api-key>"
const response = await blnk.Search.startReindex({});
started, _, _ := client.Search.StartReindex(nil)
response = blnk.search.start_reindex({})
ApiResponse<JsonNode> response = blnk.search().startReindex();
{
    "status": "in_progress",
    "phase": "indexing_transactions",
    "total_records": 2145709,
    "processed_records": 2145709,
    "started_at": "2026-02-12T12:13:10.448612096Z"
}

Monitor progress

Check the reindex status. Completion time depends on the size of your data.

curl -X GET "http://localhost:5001/search/reindex" \
  -H "X-blnk-key: <api-key>"
const response = await blnk.Search.getReindexStatus();
progress, _, _ := client.Search.GetReindexStatus()
response = blnk.search.get_reindex_status()
ApiResponse<JsonNode> response = blnk.search().getReindexStatus();
{
    "status": "completed",
    "phase": "done",
    "total_records": 3240705,
    "processed_records": 3240705,
    "started_at": "2026-02-12T12:13:10.448612096Z",
    "completed_at": "2026-02-12T12:18:42.018420264Z"
}

When Typesense hits memory limits during a reindex, Blnk pauses indexing and retries automatically instead of failing the operation. Poll this endpoint while that happens.

When paused, the response includes paused: true, pause_reason: "typesense_out_of_memory", and paused_at. Reindex resumes when Typesense memory pressure clears.

{
    "status": "in_progress",
    "phase": "indexing_transactions",
    "total_records": 3240705,
    "processed_records": 1200000,
    "started_at": "2026-02-12T12:13:10.448612096Z",
    "paused": true,
    "pause_reason": "typesense_out_of_memory",
    "paused_at": "2026-02-12T12:15:30.448612096Z"
}

Verify completeness

Once the reindex finishes, confirm that all records are in Typesense by searching each collection with q: "*" to return all records.

curl -X POST http://localhost:5001/search/{collection} \
-H 'X-blnk-key: <api-key>' \
-d '{ "q": "*" }'
const response = await blnk.Search.search(
  {
    q: '*',
  },
  'transactions',
);
results, _, _ := client.Search.SearchDocument(
    blnkgo.SearchParams{Q: "*"},
    blnkgo.Transactions,
)
response = blnk.search.search(
  {
    "q": "*",
  },
  "transactions",
)
ApiResponse<JsonNode> response = blnk.search().search(
    SearchParams.create()
        .q("*"),
    "transactions");

Compare found and out_of values with your expected record counts. If anything is missing, run the reindex again.

Error handling

Starting a second reindex while one is already running returns 409 Conflict with error_detail.code set to SRCH_REINDEX_IN_PROGRESS.

{
  "error": "A reindex operation is already in progress",
  "error_detail": {
    "code": "SRCH_REINDEX_IN_PROGRESS",
    "message": "A reindex operation is already in progress",
    "details": {
      "status": "in_progress",
      "phase": "create_collections",
      "total_records": 0,
      "processed_records": 0,
      "started_at": "2026-06-13T00:36:38.149512Z"
    }
  }
}

To resolve the error:

CodeWhat to do
SRCH_REINDEX_IN_PROGRESSPoll Check reindex progress until status is completed, then start a new reindex if needed.

For the full error catalogue, see API error codes.