# Kibana visualise using a JSON key instead of value as the Term

**URL:** https://discuss.elastic.co/t/kibana-visualise-using-a-json-key-instead-of-value-as-the-term/161026
**Category:** Kibana
**Created:** [December 16, 2018, 12:49pm UTC](https://discuss.elastic.co/t/kibana-visualise-using-a-json-key-instead-of-value-as-the-term/161026 "2018-12-16T12:49:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kibanaquestions](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@kibanaquestions](https://discuss.elastic.co/u/kibanaquestions)
#### Post date: [December 16, 2018, 12:49pm UTC](https://discuss.elastic.co/t/kibana-visualise-using-a-json-key-instead-of-value-as-the-term/161026/1 "2018-12-16T12:49:30Z")

</div>

Hi

If I have some JSON data that I've added to Kibana/Elastic and it's automatically created the index, I can easily create visualisations for the final leaf values. E.g. in the data below, I could create a pie chart with Field in a Terms aggregation as "name" or "offers.discount".

However, I can't find a way to draw a pie-chart using the JSON keys that that have child dictionaries under them as the Field? E.g. I want to use "offers" as a Field and have a pie-chart showing 2 \* discount, 2 \* get\_second\_type\_free.

```
[{
    “type”: “chocolate”,
    “name”: “Kit Kat”,
    “cost”: 1.23,
    “offers”: {
        “discount”: -0.1
    }
},
{
    “type”: “chocolate”,
    “name”: “Snickers”,
    “cost”: 4.32,
    “offers”: {
        “get_second_type_free”: “cake”
    }
},
{
    “type”: “cake”,
    “name”: “Lemon”,
    “cost”: 1.23,
    “offers”: {
        “discount”: -0.1
        “get_second_type_free”: “fruit”
    }
},
{
    “type”: “fruit”,
    “name”: “apple”,
    “cost”: 0.5,
    “offers”: null
}]

```

Thanks 🙂

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [December 20, 2018, 8:02pm UTC](https://discuss.elastic.co/t/kibana-visualise-using-a-json-key-instead-of-value-as-the-term/161026/2 "2018-12-20T20:02:27Z")

</div>

Hmm, I honestly can't think of a great way to do that. Would you mind commenting on this issue with your use case? [https://github.com/elastic/kibana/issues/25820](https://github.com/elastic/kibana/issues/25820)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 17, 2019, 8:16pm UTC](https://discuss.elastic.co/t/kibana-visualise-using-a-json-key-instead-of-value-as-the-term/161026/3 "2019-01-17T20:16:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
