# Dec 2nd, 2026: \[EN\] Categorizing toys: ES|QL requests and dashboard building

**URL:** <https://discuss.elastic.co/t/dec-2nd-2026-en-categorizing-toys-es-ql-requests-and-dashboard-building/391981>\
**Category:** Advent Calendar\
**Created:** [December 2, 2026, 8:00am UTC](https://discuss.elastic.co/t/dec-2nd-2026-en-categorizing-toys-es-ql-requests-and-dashboard-building/391981 "2026-12-02T08:00:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Dauvissat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_dauvissat/32/148345_2.png) [@Benjamin\_Dauvissat](https://discuss.elastic.co/u/Benjamin_Dauvissat)\
**Post date:** [December 2, 2026, 8:00am UTC](https://discuss.elastic.co/t/dec-2nd-2026-en-categorizing-toys-es-ql-requests-and-dashboard-building/391981/1 "2026-12-02T08:00:25Z")

</div>

The elves are curious.  
Before the Christmas rush, they want to know how toy orders are distributed around the world.  
So they set up an Elasticsearch cluster containing two indices: toys and children.  
In these times of crisis, each child can only have one toy, but every child will get one.

Here are our two indices:

```json
PUT children
{
  "mappings": {
    "properties": {
    "last_name": { "type": "keyword" },
    "first_name": { "type": "keyword" },
    "birth_date": { "type": "date", "format": "yyyy-MM-dd" },
    "city": { "type": "keyword" },
    "country": { "type": "keyword" },
    "language": { "type": "keyword" },
    "toy_id": { "type": "keyword" }
    }
  }
}

```

```json
PUT toys
{
  "settings": {
    "index.mode": "lookup"
  },
  "mappings": {
    "properties": {
    "toy_id": { "type": "keyword" },
    "name": { "type": "keyword" },
    "brand": { "type": "keyword" },
    "price_usd": { "type": "double" },
    "type": { "type": "keyword" },
    "age_category": { "type": "keyword" }
    }
  }
}

```

Toys are sorted into categories (video games or physical games).  
The first query shows how these categories are distributed among the children:

```auto
FROM children
| LOOKUP JOIN toys ON toy_id
| STATS nb_enfants = COUNT(*) BY type
| SORT nb_enfants DESC

```

A pie chart is a good fit, given the small number of categories.

 ![Capture d’écran 2026-11-27 à 14.26.40](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c2878ae984bc828cd7e4f2ed18a530d8274cc906.png)

The second query filters for video games and shows the top 10 orders:

```auto
FROM children
| LOOKUP JOIN toys ON toy_id
| WHERE type == "Video game"
| STATS nb_enfants = COUNT(*) BY name
| SORT nb_enfants DESC, name ASC
| LIMIT 10

```

A word cloud is then a good way to visualize this information.

 ![Capture d’écran 2026-11-27 à 14.33.40](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4c3ec11db7fa2c2d91b641f4d48605a007a4a3ba.png)

The third query displays the distribution of languages spoken by children who ordered a physical game:

```auto
FROM children
| LOOKUP JOIN toys ON toy_id
| WHERE type == "Physical game"
| STATS nb_enfants = COUNT(*) BY language
| KEEP language, nb_enfants
| SORT nb_enfants DESC
| LIMIT 20

```

 ![Capture d’écran 2026-11-27 à 14.33.03](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b79f08585b994ceb639b30647e3dff2b63f3eec.png)

Finally, the last query calculates each child's age and, for those aged between 8 and 12, counts the number of physical games ordered:

```auto
FROM children
| EVAL age = DATE_DIFF("year", birth_date, NOW())
| WHERE age >= 8 AND age <= 12
| LOOKUP JOIN toys ON toy_id
| STATS
    physical_games = COUNT() WHERE type == "Physical game",
    video_games = COUNT() WHERE type == "Video game"
  BY age
| KEEP age, physical_games
| SORT age

```

 ![Capture d’écran 2026-11-27 à 14.36.01](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a20f6c8084f19afb42a4b60e5e617661adf11df9.png)

Each one of this visualisations can be added to a dashboard by clicking on the icon on the top right and then choose the dashboard.

![Capture d’écran 2026-11-27 à 14.52.45](https://us1.discourse-cdn.com/elastic/original/3X/3/5/35131c9dcc8e38c916b45838c3c8894ab99d192e.png)

 ![Capture d’écran 2026-11-27 à 14.54.33](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f74113bec835162a825a8ebd4154019d43a63146.png)

Wishing you a joyful holiday season!
