Search Indexes API Routes

A search index stores the documents of an entity so they can be searched.

These API routes allow admin users to list the registered search indexes, rebuild them, and delete them.

GET /admin/search-indexes#

List Search Indexes

Retrieve the list of search indexes registered in your application, including each index's provider, lifecycle status, and the fields it stores. If the Search Module isn't installed in your application, enabled is false and search_indexes is an empty array.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Request examples

Responses

200 OK

search_indexesobject[]
The registered search indexes.
enabledboolean
Whether the Search Module is installed in the application. When false, search_indexes is an empty array.

400, 401, 404, 409, 422, 500: an error response is returned.


DELETE /admin/search-indexes/{id}#

Delete a Search Index

Delete a search index and every physical index built for it in the search engine. The index's definition isn't removed, so the next time search index migrations run, the index is built again from scratch at version 1.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The search index's name, such as product.

Request examples

Responses

200 OK

idstring
The name of the deleted search index.
objectstring
The name of the deleted object.

Default: "search_index"

deletedboolean
Whether the search index was deleted successfully.
deleted_versionsnumber
The number of the index's versions that were dropped. It's 0 when the index is registered but was never migrated.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/search-indexes/{id}/reindex#

Reindex a Search Index

Rebuild a search index's documents using the seed function of its index definition. The rebuild runs in the background, so the response is returned immediately with the ID of the triggered job. Use the List Search Indexes API route to check the index's status and know when the rebuild is done.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The search index's name, such as product.

Request body (application/json)

sincestringOptional
Rebuild only the documents that changed at or after this date, as an ISO 8601 date-time string. Like filters, this always rebuilds the index in place, as a version built from a subset of documents is never swapped in.
filtersobjectOptional
Filters passed to the seed function of the index definition to rebuild only a subset of the index's documents. The accepted shape is defined by the index, such as { ids: ["prod_123"] } if the index supports it.
strategy"swap" | "in_place"Optional
How to rebuild the index. swap builds a new version of the index and swaps it in once it's ready, whereas in_place rewrites the version that's currently serving documents. This property is ignored, and the rebuild always runs in place, when filters or since is set.

Default: "swap"

Request examples

Responses

202 OK

job_idstring
The ID of the triggered reindexing job.
indexesstring[]
The names of the indexes being reindexed.

400, 401, 404, 409, 422, 500: an error response is returned.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page