New to Kestra?
Use blueprints to kickstart your first workflows.
Rebuild a Meilisearch index safely with Kestra. Ingest a fresh corpus into a dated index, wait for indexing, and hand off the swap-indexes cutover in Slack.
Reindexing in place is how search outages happen: half-written indexes serve broken results while the rebuild runs, and a failed rebuild leaves nothing to roll back to. This blueprint uses the blue-green pattern instead. Every run builds a brand new index named with the execution date, docs_site_20250101 style, from a fresh corpus download and a Python reshape. io.kestra.plugin.meilisearch.DocumentAdd waits until the new index is fully searchable, then Slack tells the operator to verify it and swap it live with Meilisearch's atomic swap-indexes API. The serving index is never touched mid-build.
download_corpus (io.kestra.plugin.core.http.Download) fetches the complete content corpus so the rebuild starts from the full source of truth.reshape_corpus (io.kestra.plugin.scripts.python.Script on the Process task runner) writes one search document per line with id, title, and body fields, and emits doc_count through Kestra's output protocol.rebuild_index (io.kestra.plugin.meilisearch.DocumentAdd) targets a new index named docs_site_{{ execution.startDate | date('yyyyMMdd') }}. With waitForIndexing: true and a PT10M timeout, the task only succeeds once every batch is indexed; documentsAdded carries the final count.notify_operator posts the new index name and document count to Slack with the exact cutover instruction: verify a few queries, then call POST /swap-indexes with docs_site and the dated index. Meilisearch swaps them atomically, queries never see a mix, and the old content remains under the dated name as an instant rollback.errors block posts a distinct alert on failure, noting explicitly that the live index is unaffected.Schedule trigger rebuilds weekly on Sunday at 04:00.A safe reindex is a sequence with state: fetch, transform, build, wait, verify, hand off. Kestra expresses the whole sequence declaratively, carries the corpus between steps in internal storage, derives the dated index name from execution metadata, and records every rebuild in the execution history, so each dated index maps to exactly one auditable run.
MEILISEARCH_URL: Meilisearch connection URL, e.g. https://meilisearch.internal:7700.MEILISEARCH_KEY: Meilisearch API key with document write and index creation permissions.SLACK_WEBHOOK_URL: Slack incoming webhook URL.download_corpus at your real corpus and set disabled: false on the weekly trigger.http.Request task that calls POST /swap-indexes after a Pause task for manual approval, keeping the human checkpoint inside the flow.http.Request before indexing, so facets work immediately after the swap.