/esw

Primary LanguageGherkin

Elasticsearch Workshop

Workshop consists of 19 tasks for learning how to write Query DSL.

During these tasks you will learn how to do:

Pizzas

The data that are used during the workshop is a list of pizzas, see data/documents.json.

Mapping

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"
      }
    }
  }
}

Tasks

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

Initializing workshop

make init

Verifying task solutions

make solve

Evaluating queries and exploring with Kibana

  1. Access localhost:5601 in order to open Kibana.
  2. Go to Dev tools tab
  3. Execute Elasticsearch queries

Example query in Kibana:

GET /workshop/pizza/_search
{
  "query": {
    "match_all": {}
  }
}