Domain Guide — Querying, YQL, and Grouping
Vespa queries enter through the /search/ HTTP endpoint in container-jdisc (vespa/container-search),
where a chain of stateless Java Searcher components parses YQL, resolves query profiles, and
dispatches scatter-gather requests to content-nodes.
YQL (Vespa Query Language) Execution Path
- Parsing and Query Tree Construction (
vespa/container-search):- YQL statements (
select * from sources * where ...) are parsed into a typedQueryTree
supporting boolean operators (AND,OR,NOT),userInput(@q),weakAnd,wand,
nearestNeighbor(field, query_vector), andrank(...). - Query parameters (
input.query(q_vec),ranking.profile,hits,offset) are bound via
typed Query Profiles.
- YQL statements (
- Scatter-Gather Dispatch:
- The container’s dispatcher selects a content group and broadcasts the serialized query over
FNET/RPC toprotonnodes (vespa/searchcore). - Phase 1 returns top-K docsums/scores; Phase 2 fetches full document summaries for the winning
global hits.
- The container’s dispatcher selects a content group and broadcasts the serialized query over
- Distributed Grouping (
vespa/searchcore/src/vespa/searchcore/grouping/):- Multi-level
all(group(...) each(output(...)))expressions aggregate attributes across content
nodes in parallel and merge intermediate buckets invespa/container-search.
- Multi-level
Client Tooling
- Python query construction and evaluation:
pyvespa/vespa/querybuilder/(see work-areas). - Agent query authoring patterns:
skills/query-builder/SKILL.md(see search-ranking and ai-rag).