DocumentGet icon
Script icon
Process icon
If icon
DiscordIncomingWebhook icon
Log icon
Schedule icon

Meilisearch Content Freshness Probe with a Sentinel Document

Detect stale Meilisearch content with Kestra. Fetch a sentinel document, compare its updated_at age against a limit, and alert Discord when it is stale.

Categories
Data

An index that answers queries is not necessarily an index that is up to date. When the ingest pipeline silently stops, search keeps working on old content and nobody notices until a user searches for a page published last week. This blueprint measures freshness directly: the ingest pipeline upserts a sentinel document with an updated_at timestamp on every run, and this probe fetches it with io.kestra.plugin.meilisearch.DocumentGet, computes its age in Python, and alerts Discord the moment the age exceeds your budget.

How it works

  1. get_sentinel (io.kestra.plugin.meilisearch.DocumentGet) fetches the sentinel by the sentinel_document_id input from the docs_site index. The document is exposed as a JSON object at {{ outputs.get_sentinel.document }}.
  2. check_freshness (io.kestra.plugin.scripts.python.Script on the Process task runner) receives the scalar updated_at field and the max_age_hours input through environment variables, computes the age, and emits is_stale and age_hours through Kestra's output protocol.
  3. check_stale (io.kestra.plugin.core.flow.If) branches on {{ outputs.check_freshness.vars.is_stale }}: a Discord alert with the exact age and limit when stale, a log line with the same numbers when fresh.
  4. The errors block posts a distinct Discord alert when the probe itself fails, which includes the telling case of a missing sentinel after an index rebuild.
  5. A disabled-by-default Schedule trigger runs the probe hourly.

What you get

  • Freshness monitoring that measures the content itself, not the process that was supposed to update it.
  • A tunable age budget as a flow input, defaulting to 26 hours for a daily ingest with jitter allowance.
  • Alert messages that carry the actual age and the limit, so severity is obvious without opening Kestra.
  • A probe that also catches index rebuilds that forgot to restore the sentinel.

Who it's for

  • Teams running a scheduled ingest into Meilisearch who want an independent check that it keeps running.
  • Platform engineers who prefer measuring outcomes (fresh content) over processes (cron ran).
  • Anyone who has been burned by a paused schedule or an expired credential that failed without an alert.

Why orchestrate this with Kestra

The freshness check is three small steps that need to run every hour, share data, branch on a verdict, and alert reliably. Kestra wires the document fetch into the Python comparison through outputs, evaluates the boolean with a declarative If, and keeps every probe in the execution history, so you can also see how close the pipeline typically runs to its budget.

Prerequisites

  • A Meilisearch index whose ingest pipeline upserts a sentinel document with an ISO 8601 updated_at field, as suggested in the docs site ingest blueprint.
  • A Discord incoming webhook for staleness and failure alerts.

Secrets

  • MEILISEARCH_URL: Meilisearch connection URL, e.g. https://meilisearch.internal:7700.
  • MEILISEARCH_KEY: Meilisearch API key with document read permissions.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the three secrets to your Kestra namespace.
  2. Extend your ingest pipeline to upsert a document with id docs-freshness-sentinel and a current updated_at timestamp on every run.
  3. Execute the probe and confirm the fresh branch logs the sentinel age.
  4. Set disabled: false on the hourly trigger.

How to extend

  • Fail the execution on staleness with io.kestra.plugin.core.execution.Fail so freshness shows up in dashboards, as the search canary blueprint does for hit counts.
  • Probe several indexes by looping over sentinel ids with a ForEach.
  • Trigger the index rebuild pipeline blueprint automatically from the stale branch with a Subflow task.
  • Record age_hours to the KV store on every run to chart freshness drift over time.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.