Vespa Trigger
Certified
Start a flow when new documents match a Vespa query
Vespa Trigger
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.
type: io.kestra.plugin.vespa.TriggerExamples
Log each album added to the catalog, once.
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
endpoint *string
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.
watermarkField *string
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 *string
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).
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
connectTimeout string
The time allowed to connect to Vespa
Unset uses the Kestra HTTP client's default.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEResult 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.
hits integerstring
100Most 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.
interval string
PT1MdurationTime between two polls
Default 60 seconds.
parameters object
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.
query string
Text for userQuery() in the YQL
queryTimeout string
Vespa's own time limit for the query
ranking string
Rank profile to rank the hits with
Sent as ranking.profile. The hits are still delivered in watermarkField order.
readTimeout string
The longest wait for data from Vespa
Defaults to 5 minutes.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
token string
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.
when string
trueA 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.
Outputs
row object
First hit as a row
Only with fetchType=FETCH_ONE; null when nothing matched.
rows array
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.
size integer
Number of rows in the outputs or in the stored file
Null with fetchType=NONE.
totalCount integer
Number of documents matching the query
Vespa's totalCount, which can be larger than the hits returned.
uri string
uriURI 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.