WP-CLI
wp searchsync reindex
Rebuilds your indexes.
# Every index
wp searchsync reindex
# One index, by name
wp searchsync reindex --index=courses_index
The command stops with an error if staging mode is on ("Records not indexed. API is not enabled.") or if no search backend is connected.