# Line chart help

**URL:** https://discuss.elastic.co/t/line-chart-help/126586
**Category:** Kibana
**Created:** [April 3, 2018, 1:59pm UTC](https://discuss.elastic.co/t/line-chart-help/126586 "2018-04-03T13:59:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![george1](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@george1](https://discuss.elastic.co/u/george1)
#### Post date: [April 3, 2018, 1:59pm UTC](https://discuss.elastic.co/t/line-chart-help/126586/1 "2018-04-03T13:59:06Z")

</div>

Hello.

I'm using logstash as a pipeline between my csv file and elasticsearch.

The csv file looks like this:

student1,90,80,85,95  
student2,50,60,55,100  
student3,40,70,50,60

Therefore in my kibana index "student" there are three documents one for each student and each student has the following fields:  
studentname,test1,test2,test3,test4

I'm trying to use Kibana to archieve this:

 ![example](https://us1.discourse-cdn.com/elastic/original/3X/4/3/439b4737f979129c6ce1e10cd607ab086f1b516c.png)

Any suggestion on how to use kibana for this? or do I have the wrong data structure?  
Any feedback in appreciated.

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [April 13, 2018, 6:55pm UTC](https://discuss.elastic.co/t/line-chart-help/126586/2 "2018-04-13T18:55:40Z")

</div>

Hi George,

that should be fine. but it depends how you modeled your documents in Elasticsearch:

1. you have 3 documents (one doc for each student), each document with 4 fields (one for each test).

Even though it looks the simplest, ES is not a spreadsheet. So this won't work. The aggregation framework is not build for this.

1. the canonical way of doing this in Elasticsearch would be to denormalize your data, and have a separate document for each student and test combo. You'd have 12 documents. Each document would have a `student`-field, a `testid` field and a `testscore` field.

Then you can just do two nested "Terms aggregation", once on `testid`, which you can map to the X-axis, and once on `student`, which you use to split the series . On the Y-axis you plot the computed metric, in this case the (average) score per student.

It's easier to think of Elasticsearch as storing a collection of measurements (sensor data, log data, ...). A test-score is basically a measurement for the tuple `{student, testid}`.

---

<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: [May 11, 2018, 6:55pm UTC](https://discuss.elastic.co/t/line-chart-help/126586/3 "2018-05-11T18:55:45Z")

</div>

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