# Group By field?

**URL:** <https://discuss.elastic.co/t/group-by-field/164626>\
**Category:** Kibana\
**Created:** [January 17, 2019, 12:05pm UTC](https://discuss.elastic.co/t/group-by-field/164626 "2019-01-17T12:05:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wassim\_Ben\_Amor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wassim_ben_amor/32/39799_2.png) [@Wassim\_Ben\_Amor](https://discuss.elastic.co/u/Wassim_Ben_Amor)\
**Post date:** [January 17, 2019, 12:05pm UTC](https://discuss.elastic.co/t/group-by-field/164626/1 "2019-01-17T12:05:12Z")

</div>

Hello,  
I have documents with user\_id, session\_id and timestamp

How can I create a Pie chart that shows how many session\_ids per user ? ( for example 50 users having 1 session\_id and 70 users having 2 session\_id )

Also, How can I create a timeline showing how many daily average session\_ids per user

Thank you.

---

<div class="post-metadata">

**Author:** ![stiltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stiltz/32/39714_2.png) [@stiltz](https://discuss.elastic.co/u/stiltz)\
**Post date:** [January 17, 2019, 3:16pm UTC](https://discuss.elastic.co/t/group-by-field/164626/2 "2019-01-17T15:16:08Z")

</div>

An easy way to show what you're looking for is with the donut chart (an option under pie chart).  
Here is an example of what the configuration would look like:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/2/42b89369fbe71cc7ce56654c54e9a743930b8152.png)

instead of host.keyword you would use user\_id and instead of machine.os.keyword you would use session\_id.

I'll see about putting together an example of your second request if I have some cycles this afternoon.

---

<div class="post-metadata">

**Author:** ![Wassim\_Ben\_Amor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wassim_ben_amor/32/39799_2.png) [@Wassim\_Ben\_Amor](https://discuss.elastic.co/u/Wassim_Ben_Amor)\
**Post date:** [January 18, 2019, 1:45pm UTC](https://discuss.elastic.co/t/group-by-field/164626/3 "2019-01-18T13:45:03Z")

</div>

Hello,  
Thank you for your reply,  
I don't really want two levels of the donut.  
I just want a simple Pie like this

 ![21](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1b441222066fcbde0b61217abf91bc97978449d1.png)  
I think I can do this only with sql ( using GROUP BY )  
What do you think ?

---

<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:** [February 15, 2019, 1:45pm UTC](https://discuss.elastic.co/t/group-by-field/164626/4 "2019-02-15T13:45:04Z")

</div>

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