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. I’ll be posting solutions soon.
Write a query to return the first 50 documents for gold medal athletics events, in descending age order.
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.
Download the file of National Olympic Committees from here and use Kibana’s Data Visualizer to import the data into a new index called
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.
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
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.
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.