Vespa Query Language - YQL

Vespa accepts unstructured human input and structured queries for application logic separately, then combines them into a single data structure for executing. Human input is parsed heuristically, while application queries are formulated in YQL.

A simple query URL looks like:

http://myhost.mydomain.com:8080/search/?yql=select%20%2A%20from%20sources%20%2A%20where%20text%20contains%20%22blues%22%3B
In other words, yql contains:
select%20%2A%20from%20sources%20%2A%20where%20text%20contains%20%22blues%22%3B
This matches all documents where the field named text contains the word blues.

This document has examples and guides for how to use search operators as found in the query language reference.

Example queries:

Ordering
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where default contains \"bad\" order by year desc;"}' \
    http://localhost:8080/search/
Grouping
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where default contains \"bad\" | all(group(year) each(output(sum(duration))));"}' \
    http://localhost:8080/search/
Pagination
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where default contains \"bad\" limit 2 offset 1;"}' \
    http://localhost:8080/search/
Numeric
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where year > 2000;"}' \
    http://localhost:8080/search/
Boolean
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where alive = true;"}' \
    http://localhost:8080/search/
Phrase
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where artist contains phrase(\"michael\", \"jackson\");"}' \
    http://localhost:8080/search/
Timeout
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where default contains \"bad\" timeout 100;"}' \
    http://localhost:8080/search/
Regexp
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where title matches \"mado[n]+a\";"}' \
    http://localhost:8080/search/
Count
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where sddocname contains \"music\";"}' \
    http://localhost:8080/search/
Map
$ curl -H "Content-Type: application/json" \
    --data '{"yql" : "select * from sources * where my_map contains sameElement(key contains \"Coldplay\", weight > 10);"}' \
    http://localhost:8080/search/

field my_map type map<string, int> {
    indexing: summary
    struct-field key   { indexing: attribute }
    struct-field value { indexing: attribute }
}