Vespa Trigger

Vespa Trigger

Certified

Start a flow when new documents match a Vespa query

Runs a YQL query every interval and starts the flow with the documents it hasn't delivered before, as trigger.rows (or in the file at trigger.uri with fetchType=STORE), in the same shape as the Query task. Each document is delivered once: the trigger remembers the highest watermarkField value it delivered, so that field must grow with every write, like the time the document was fed.

yaml
type: io.kestra.plugin.vespa.Trigger

Log each album added to the catalog, once.

yaml
id: vespa_new_albums
namespace: company.team

triggers:
  - id: new_albums
    type: io.kestra.plugin.vespa.Trigger
    endpoint: "{{ secret('VESPA_ENDPOINT') }}"
    token: "{{ secret('VESPA_TOKEN') }}"
    yql: "select * from music where genre contains \"jazz\""
    watermarkField: added_at
    interval: PT5M

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ trigger.size }} new albums, the first is {{ trigger.rows[0].fields.album }}"
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-vespa --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Vespa endpoint

Base URL of the Vespa container cluster serving the query and document APIs, like http://localhost: 8080 or a Vespa Cloud endpoint. A trailing / is ignored.

Numeric attribute that orders the documents

An int or long attribute that grows with every write, like the time the document was fed in milliseconds. The watermark lives in the flow's namespace KV store under vespa_trigger_watermark_<flow id length>_<flow id>_<trigger id length>_<trigger id>: delete that key to start over.

YQL query

Like select * from music where genre contains "jazz". Each hit must carry its document ID and a watermarkField value, as select * does. No order by (the trigger sorts by watermarkField), no offset and no limit (set hits instead).

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

The time allowed to connect to Vespa

Unset uses the Kestra HTTP client's default.

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

Result handling mode

Default FETCH, which delivers the documents as trigger.rows; STORE delivers them in an ION file at trigger.uri. FETCH_ONE and NONE are refused.

Default100

Most documents delivered by one poll

Default 100, at least 1. The trigger asks Vespa for hits plus the documents it already delivered at the watermark value, and Vespa refuses more than its maxHits in one answer (400 unless the application's query profile raises it), so leave room: keep hits well under maxHits. The plugin reads at most 32 MiB of Vespa's answer and a bigger one fails the poll, so with many hits ask for fewer hits or summary fields.

DefaultPT1M
Formatduration

Time between two polls

Default 60 seconds.

Other query API parameters

Sent as they are, like in the Query task. recall, sorting, sorting.degrading, hits, offset and their aliases are refused: the trigger sets the first ones itself, and an offset would skip documents.

Text for userQuery() in the YQL

Vespa's own time limit for the query

Rank profile to rank the hits with

Sent as ranking.profile. The hits are still delivered in watermarkField order.

The longest wait for data from Vespa

Defaults to 5 minutes.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Data-plane token

Vespa Cloud data-plane token, sent as a bearer token. Unset or empty sends no token, for a self-hosted Vespa without authentication.

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

First hit as a row

Only with fetchType=FETCH_ONE; null when nothing matched.

SubTypeobject

Hits as rows

Only with fetchType=FETCH; with STORE the rows are in the file at uri. Each row holds id, relevance and the document under fields.

Number of rows in the outputs or in the stored file

Null with fetchType=NONE.

Number of documents matching the query

Vespa's totalCount, which can be larger than the hits returned.

Formaturi

URI of the file with the hits

Only with fetchType=STORE: an ION file in Kestra's internal storage, one record per hit, each with id, relevance and the document under fields.