# Timelion graph for dynamic array elements

**URL:** <https://discuss.elastic.co/t/timelion-graph-for-dynamic-array-elements/172347>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [March 14, 2019, 2:12pm UTC](https://discuss.elastic.co/t/timelion-graph-for-dynamic-array-elements/172347 "2019-03-14T14:12:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirco-s](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mirco-s](https://discuss.elastic.co/u/mirco-s)\
**Post date:** [March 14, 2019, 2:12pm UTC](https://discuss.elastic.co/t/timelion-graph-for-dynamic-array-elements/172347/1 "2019-03-14T14:12:52Z")

</div>

Hi,

I've got data as follows and would like to render a graph with Timelion.

```
{
  "_index": "test",
  "_type": "summary",
  "_id": "1552561142688",
  "_version": 1,
  "_score": null,
  "_source": {
    "databaseProductName": {
      "MySQL_5-5": 20,
      "MySQL_5-6": 41,
      "Microsoft_SQL_Server_12-00": 97,
      "Microsoft_SQL_Server_13-00": 124,
      "Microsoft_SQL_Server_14-00": 57
    }
  },
  "fields": {
    "reportTimestamp": [
      "2019-03-14T10:59:02.688Z"
    ]
  },
}

```

In Elastic this means something like this:  
databaseProductName.MySQL\_5-5 with value 20  
databaseProductName.MySQL\_5-6 with value 41  
etc.

There is one document per day. The graph should show one line per databaseProductName (e.g. MySQL\_5-5) with the value (e.g. 20). The databaseProductName keys are dynamic so new names can occur anytime. I don't want to manually update the graph to include new names.

I thought this should be easy with Timelion but so far I struggled to find a way to do it. Can this be achieved with Timelion or other Kibana means?

Thanks!

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [March 22, 2019, 11:40am UTC](https://discuss.elastic.co/t/timelion-graph-for-dynamic-array-elements/172347/2 "2019-03-22T11:40:04Z")

</div>

They way the data looks now it's very hard to draw the graph that you want. I would recommend changing the way the data ingest looks, creating one document for each datbaseProductName. It can have the same data except having two fields instead of that array:  
databaseProductname as a string, with the key from the pair, example: "MySQL\_5-5"  
databaseProductValue as a number, with the value from the pair, example: 20

then you can do filters and various aggregations on the databaseProductName field.

---

<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:** [April 19, 2019, 11:40am UTC](https://discuss.elastic.co/t/timelion-graph-for-dynamic-array-elements/172347/3 "2019-04-19T11:40:08Z")

</div>

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