Reindex YourBOX Meilisearch
When To Use
Section titled “When To Use”Use this runbook when:
- The daily reconciliation reports a drift between PostgreSQL and the Meilisearch index.
- A Meilisearch upgrade requires reapplying the settings.
- A search ranking adjustment changes the index settings file.
- The Messenger consumer has been disabled for an extended outage and the projection lag exceeds 24 hours.
The runbook does not require a maintenance window. The search remains available throughout, with degraded freshness while the reindex runs.
Preconditions
Section titled “Preconditions”- The PostgreSQL source is healthy.
- The Meilisearch instance is reachable through
MEILISEARCH_URL. - The Messenger consumer is running. If it is not, the runbook starts it first.
Procedure
Section titled “Procedure”-
Confirm the index is reachable.
Terminal window curl --silent --header "Authorization: Bearer ${MEILISEARCH_KEY}" \"${MEILISEARCH_URL}/health"Expected result:
{"status":"available"}. -
Drain the Messenger consumer.
Terminal window kubectl -n yourbox annotate deployment/yourbox-worker \yourbox.io/drain=true --overwritekubectl -n yourbox rollout restart deployment/yourbox-workerExpected result: the consumer pod restarts in drain mode and processes already in flight messages without picking up new ones.
-
Reset the index.
Terminal window php app/bin/console catalog:search:reset --no-debugExpected result: the command reports
Deleted index yourbox-videos. The search controller catches the missing index error and serves a degraded results page until the reindex completes. -
Reapply the settings.
Terminal window php app/bin/console catalog:search:apply-settings \--settings=app/config/meilisearch/settings.jsonExpected result: the command reports
Settings applied (task UID <N>). The task UID resolves under${MEILISEARCH_URL}/tasks/<N>. -
Run the reindex.
Terminal window php app/bin/console catalog:search:reindex --batch-size=500 \--no-debugExpected result: the command reports the document count copied per batch, with a final line
Reindex succeeded: <N> documents. The number matches the published video count in PostgreSQL. -
Resume the Messenger consumer.
Terminal window kubectl -n yourbox annotate deployment/yourbox-worker \yourbox.io/drain- --overwritekubectl -n yourbox rollout restart deployment/yourbox-workerExpected result: the consumer restarts and processes the queued messages within the lag SLO.
-
Verify the search.
Terminal window curl --silent "${MEILISEARCH_URL}/indexes/yourbox-videos/search" \-H "Authorization: Bearer ${MEILISEARCH_KEY}" \-H "Content-Type: application/json" \--data '{"q":"one piece"}'Expected result: a JSON response with at least one hit matching the sample query (assuming the sample data is present in the environment).
Validation
Section titled “Validation”- The Grafana panel
YourBOX > Overview > Search latency p95stays below 150 ms. - The Prometheus metric
yourbox_search_documents_totalmatchesyourbox_videos_published_total. kubectl -n yourbox logs deployment/yourbox-worker --since=15m | grep -i meilisearch | grep -i errorreturns no results.
If This Does Not Work
Section titled “If This Does Not Work”If the reindex stalls, inspect the Meilisearch task queue:
curl --silent "${MEILISEARCH_URL}/tasks?statuses=processing,enqueued" \ -H "Authorization: Bearer ${MEILISEARCH_KEY}"If a task is stuck, cancel it and resume the reindex from the last batch identifier reported in the importer log:
curl --silent -X POST \ "${MEILISEARCH_URL}/tasks/cancel?uids=<N>" \ -H "Authorization: Bearer ${MEILISEARCH_KEY}"Escalate to the platform on call when the Meilisearch instance reports disk pressure or memory pressure for more than 5 minutes.