Introduction
We will use a bit more of Elasticsearch’s query DSL in this round of labs, and then use the enrich processor to add details of the National Olympic Committee.
This is the last round of exercises using the Olympics data. I encourage you to continue learning with the data.
If you enjoyed the exercises, please let me know.
Exercises
Exercise 25
Write a query to return the first 50 documents for gold medal athletics events, in descending age order.
Exercise 26
Write a query to match swimming events where either:
- The athlete’s weight was between 60kg and 70kg
- The athlete’s age was less than 20
Enhance the query so the results identify whether the weight, age, or both matched the search criteria.
Exercise 27
Download the file of National Olympic Committees from here and use Kibana’s Data Visualizer to import the data into a new index called olympic-noc-regions
.
Exercise 28
Change the number of replica shards for the olympic-noc-regions
index to be 0
. The index should then be green and contain 230 documents.
Exercise 29
Create an enrich policy and ingest pipeline that uses the enrich
processor to add details of the National Olympic Committee to each document in the olympic-events-fixed
index. Call the policy olympic-noc-append
and the pipeline enrich-noc
. Add details of the matching NOC entry to a new field called nocDetails
, matching on the noc
field.
Exercise 30
Create a new index called olympic-events-enriched
, into which we can reindex the Olympic events but with some enriched fields. Change the mapping settings for the new index so we can add fields dynamically.
Exercise 31
Reindex the olympic-events-fixed
index into olympic-events-enriched
, running it through the enrich-noc
ingest pipeline. Once complete, verify the new field was added to the olympic-events-fixed
index, and populated with details of the associated NOC.
Solutions
Congratulations for reaching the end! Solutions to all these exercises are now available, with the first set here.