Vespa Query
Certified
Query Vespa with YQL
Vespa Query
Query Vespa with YQL
Runs one YQL query on the Vespa query API and returns the hits of that one answer as rows, in Vespa's own hit shape: id, relevance and the document's summary fields under fields, read like rows[0].fields.album. With fetchType=STORE the rows go to an ION file in Kestra's internal storage instead, and the outputs carry its uri. Default fetchType=FETCH.
type: io.kestra.plugin.vespa.QueryExamples
Search albums by text and log how many matched.
id: vespa_query
namespace: company.team
inputs:
- id: text
type: STRING
defaults: blue
tasks:
- id: search
type: io.kestra.plugin.vespa.Query
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
yql: "select * from music where userQuery()"
query: "{{ inputs.text }}"
hits: 5
- id: log_hits
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.search.size }} of {{ outputs.search.totalCount }} albums, first: {{ outputs.search.rows[0].fields.album }}"
Find the nearest neighbours of a vector with a rank profile.
id: vespa_nearest_neighbours
namespace: company.team
tasks:
- id: nearest
type: io.kestra.plugin.vespa.Query
endpoint: "{{ secret('VESPA_ENDPOINT') }}"
token: "{{ secret('VESPA_TOKEN') }}"
yql: "select * from music where {targetHits:3}nearestNeighbor(embedding, q)"
ranking: closeness
parameters:
input.query(q): [0, 0, 1, 0]
fetchType: FETCH_ONE
- id: log_closest
type: io.kestra.plugin.core.log.Log
message: "Closest album: {{ outputs.nearest.row.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.
yql *string
YQL query
Like select * from music where genre contains "jazz".
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
{}1150connectTimeout string
The time allowed to connect to Vespa
Unset uses the Kestra HTTP client's default.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEResult handling mode
FETCH returns the hits of one answer as rows (as many as hits, Vespa's default 10), FETCH_ONE the first hit as row, STORE writes the hits of one answer to an ION file in Kestra's internal storage and returns its uri, NONE only totalCount.
hits integerstring
Number of hits to return in one answer
Unset, Vespa returns 10 hits with fetchType=FETCH or STORE; the task asks for 1 with FETCH_ONE and 0 with NONE. Vespa refuses more than 400 unless the application raises maxHits in its query profile. The plugin reads at most 32 MiB of Vespa's answer and a bigger one fails the task, so with many hits ask for fewer hits or summary fields.
offset integerstring
Number of hits to skip
Default 0. Vespa refuses more than 1000 unless the application raises maxOffset in its query profile.
parameters object
Other query API parameters
Sent as they are, flat or nested, like input.query(q) for a query tensor, presentation.format.tensors: short-value or ranking: {matchPhase: {maxHits: 100}}. A parameter also set by a property of this task, by name or by Vespa's alias (count, start, ranking.profile, model.queryString), in any case and flat or nested, fails the task.
query string
Text for userQuery() in the YQL
Unset, a YQL that uses userQuery() fails with Vespa's "No query".
queryTimeout string
Vespa's own time limit for the query
Unset, Vespa's default is 0.5 seconds. The task's timeout bounds the whole task; this one is sent to Vespa.
ranking string
Rank profile to rank the hits with
Sent as ranking.profile. Unset, Vespa ranks with the default profile.
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
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.
Metrics
records counter
recordsNumber of rows in the outputs or in the stored file