Vespa Feed
Certified
Feed documents to Vespa
Vespa Feed
Feed documents to Vespa
Writes, updates or removes many documents through Vespa's feed client, which retries throttled and unavailable answers and adapts how many operations run at once. Each record is a map with id and, except for REMOVE, fields. Records Vespa refuses fail the task, or with failOnError: false end it in WARNING with the failed records in an ION file. The feed client has its own HTTP stack: connectTimeout is unused (the client waits 30 seconds to connect), and endpoint must have no path (only scheme, host and port), since the client sends to the host's root. Before feeding, Feed sends one HEAD /state/v1/health through Kestra's HTTP client, so Kestra's allowed and denied hosts apply to it too. A kestra:// file in from is read whole into memory before the first record is sent.
type: io.kestra.plugin.vespa.FeedExamples
Feed albums written by a previous task, keyed by their name.
id: vespa_feed
namespace: company.team
tasks:
- id: write
type: io.kestra.plugin.core.storage.Write
extension: .ion
content: |
{id:"kind-of-blue",fields:{artist:"Miles Davis",album:"Kind of Blue",year:1959}}
{id:"a-love-supreme",fields:{artist:"John Coltrane",album:"A Love Supreme",year:1965}}
- id: feed
type: io.kestra.plugin.vespa.Feed
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
from: "{{ outputs.write.uri }}"
namespace: mynamespace
documentType: music
Update one field of many documents and keep going when some fail.
id: vespa_feed_update
namespace: company.team
tasks:
- id: update
type: io.kestra.plugin.vespa.Feed
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
operation: UPDATE
failOnError: false
from:
- id: "id:mynamespace:music::kind-of-blue"
fields:
genre:
assign: jazz
- id: "id:mynamespace:music::a-love-supreme"
fields:
genre:
assign: jazz
- id: log_failures
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.update.failureCount }} updates failed, see {{ outputs.update.uri ?? 'nothing' }}"
Upsert documents, creating the ones that don't exist yet, and update only those still in stock.
id: vespa_feed_upsert
namespace: company.team
tasks:
- id: upsert
type: io.kestra.plugin.vespa.Feed
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
operation: UPDATE
createIfNotExists: true
namespace: mynamespace
documentType: music
from:
- id: kind-of-blue
fields:
stock:
assign: 3
- id: reprice
type: io.kestra.plugin.vespa.Feed
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
operation: UPDATE
condition: "music.stock > 0"
failOnError: false
namespace: mynamespace
documentType: music
from:
- id: kind-of-blue
fields:
price:
assign: 9.99
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.
from *stringarrayobject
Structured data items, either as a map, a list of map, a URI, or a JSON string.
Structured data items can be defined in the following ways:
- A single item as a map (a document).
- A list of items as a list of maps (a list of documents).
- A URI, supported schemes are
kestrafor internal storage files,filefor host local files, andnsfilefor namespace files. - A JSON String that will then be serialized either as a single item or a list of items.
Each record is a map with
idandfields;REMOVEneeds onlyid, and other keys are ignored. Kestra reads akestra://file whole into memory before the first record is sent, so split very large files across several runs.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150condition string
Write each record only if its document matches
Vespa's test-and-set condition, in its document selection language with the document type before the field, like music.year==2000. A record whose document doesn't match, or doesn't exist, is a failed record (see failOnError), unless createIfNotExists writes the missing document. One condition for the whole run.
connectTimeout string
The time allowed to connect to Vespa
Unset uses the Kestra HTTP client's default.
createIfNotExists booleanstring
falseCreate the document when it doesn't exist
true makes an UPDATE of a missing document create it first (an upsert). With condition, a PUT or UPDATE of a missing document is written without checking the condition. No effect on REMOVE, or on PUT without condition. Default false.
documentType string
Vespa document type for record keys
With namespace, completes a record id that doesn't start with id: . An id that starts with id: is used as is.
failOnError booleanstring
trueFail the task when a record fails
Default true: the good records are still written, then the task fails naming the first failed ones. false ends the task in WARNING with the failed records in the ION file uri.
maxInFlight integerstring
4096Most records waiting for Vespa's answer at one time
From 1 to 4096, default 4096 (the feed client's own ceiling). The client still adapts how many it sends below this value; lower it to put less load on Vespa. It doesn't change how much of from the worker holds in memory.
namespace string
Vespa namespace for record keys
With documentType, completes a record id that doesn't start with id: into id: <namespace>: <documentType>::<id>. An id that starts with id: is used as is.
operation string
PUTPUTUPDATEREMOVEWhat to do with each record
PUT (default) writes the whole document, replacing one with the same ID. UPDATE changes fields of an existing document, with fields in Vespa's update format, like {"album": {"assign": "Kind of Blue"}}; Vespa accepts an update of a missing document and changes nothing, so it counts as a success; set createIfNotExists: true to create it instead. A retried UPDATE with increment applies twice. REMOVE deletes the document; removing a missing one succeeds.
readTimeout string
The longest wait for data from Vespa
Defaults to 5 minutes.
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.
Outputs
failureCount integer
Number of records that failed
Refused by Vespa, invalid (no usable id, no fields) or out of time. A record that ran out of time may still have been applied by Vespa.
successCount integer
Number of records Vespa applied
uri string
uriURI of the failed records
An ION file in Kestra's internal storage, one row per failed record: record (the record as given) and error. To feed them again, read each row's record. Null when nothing failed.
Metrics
records.failed counter
recordsRecords refused, invalid or timed out
records.succeeded counter
recordsRecords Vespa applied