/search/) provides HTTP access to query Vespa and retrieve documents. It supports the powerful YQL query language, ranking, grouping, and various result presentation formats.
Base URL
Quick Start
Query Methods
The Search API supports both GET and POST methods:- GET
- POST
Parameters in URL query string:
Core Parameters
Query
YQL query string. The primary way to query Vespa.Example:
select * from music where artist contains "waits"Simple query string (alternative to YQL for basic queries)Example:
artist:waitsSearch chain to execute. Use
vespa for fallback chain.Result Control
Number of hits to return (maximum configurable per deployment)
Number of hits to skip (for pagination)
Query timeout (e.g.,
5s, 500ms)Response format:
json or cborLegacy parameter for format
Ranking
Rank profile to use for scoring resultsExample:
ranking.profile=bm25Query tensor for rankingExample:
ranking.features.query(embedding)=[1,2,3]Enable soft timeout (return partial results if timeout is near)
Fraction of timeout when soft timeout triggers (0.0-1.0)
Field Filtering
Document summary class to use (controls which fields are returned)
Alias for
presentation.summaryTracing and Debugging
Trace level 0-9 for query execution details
Include timestamps in trace output
Include detailed timing information
Explain level for ranking (0-3)
YQL Queries
YQL (Vespa Query Language) is the primary query language:Basic Query
Field Selection
Multiple Conditions
Full-Text Search
userQuery() parses the query parameter for user-friendly search.Ordering
Limiting Results
Grouping and Aggregation
Response Format
Successful Response
Root result object
Total number of hits matching the query
Coverage information about the search
Percentage of corpus searched (0-100)
Total documents searched
Whether full coverage was achieved
Array of hit documents
Document ID
Relevance score for this hit
Document fields
Error Response
Array of error objects
Error code
Brief error description
Detailed error message
Advanced Features
Grouping and Aggregation
Group results and compute aggregates:count()- Count documentssum(field)- Sum numeric fieldavg(field)- Average of fieldmax(field)- Maximum valuemin(field)- Minimum value
Semantic Search with Embeddings
Query with tensor (embedding) similarity:Faceting
Get facet counts for categorical fields:Pagination
Paginate through results:Geographic Search
Query documents near a location:Highlighting
Highlight matching terms in results:Enable term highlighting
Generate dynamic teasers
<hi> tags:
Query Profiles
Use predefined query profiles:Query profile name to use
Collapsing (Deduplication)
Collapse similar results:Field to collapse on
Number of hits to keep per collapse value
Streaming Search
For latency-critical queries with guaranteed freshness:Selection expression for streaming mode
Performance Optimization
Result Caching
Disable result cache for this query
Don’t write results to cache
Timeout Control
Field Sets
Retrieve only necessary fields:HTTP Status Codes
| Status | Description |
|---|---|
| 200 OK | Query executed successfully |
| 400 Bad Request | Invalid query syntax or parameters |
| 500 Internal Server Error | Server error during query execution |
| 504 Gateway Timeout | Query exceeded timeout |
Even with errors, the Search API typically returns 200 OK with errors in the JSON response body.