Vespa Query

Vespa Query

Certified

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.

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

Search albums by text and log how many matched.

yaml
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.

yaml
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

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 query

Like select * from music where genre contains "jazz".

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.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset 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.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

The time allowed to connect to Vespa

Unset uses the Kestra HTTP client's default.

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

Result 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.

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.

Number of hits to skip

Default 0. Vespa refuses more than 1000 unless the application raises maxOffset in its query profile.

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.

Text for userQuery() in the YQL

Unset, a YQL that uses userQuery() fails with Vespa's "No query".

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.

Rank profile to rank the hits with

Sent as ranking.profile. Unset, Vespa ranks with the default profile.

The longest wait for data from Vespa

Defaults to 5 minutes.

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.

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.

Unitrecords

Number of rows in the outputs or in the stored file