Workshop consists of 19 tasks for learning how to write Query DSL.
During these tasks you will learn how to do:
- Match all (task 0)
- Full-text search (task 1-4)
- Filtering (task 5-8)
- Aggregations (task 9-13)
- Combine full-text search and aggregations (task 14)
- Sorting (task 15)
- Highlightning (task 16)
- Pagination (task 17-18)
The data that are used during the workshop is a list of pizzas, see data/documents.json.
Mapping is the process of defining how a document, and the fields it contains, are stored and indexed.
The pizzas has the data/mapping.json:
{
"pizza": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text"
},
"topping": {
"type": "text",
"index": "true"
},
"weight": {
"type": "long"
}
}
}
}
The tasks are based on feature tests, and they look like this:
Feature: Topic of the task
// Use reference to documentation
Scenario: Description of the task
Given all pizzas are indexed
When I make a query
"""
{ todo }
"""
Then the response should contain
"""
{ subset }
"""
Your task is to replace the { todo }
with the correct query.
The comment use https://...
points you to the page where you can find information about how to write the correct query.
A query needs to return a correct response { subset }
to be passed. To make the tests more compact and easy to read, they only compare and validates against a { subset }
.
make init
make solve
- Access localhost:5601 in order to open Kibana.
- Go to
Dev tools
tab - Execute Elasticsearch queries
Example query in Kibana:
GET /workshop/pizza/_search
{
"query": {
"match_all": {}
}
}