# Show last n records in Kibana ascending order

**URL:** <https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717>\
**Category:** Kibana\
**Created:** [April 26, 2019, 7:40pm UTC](https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717 "2019-04-26T19:40:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sabri\_Mutlucag](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@Sabri\_Mutlucag](https://discuss.elastic.co/u/Sabri_Mutlucag)\
**Post date:** [April 26, 2019, 7:40pm UTC](https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717/1 "2019-04-26T19:40:13Z")

</div>

Hi,

I have docs on ElasticSearch. Each document has **idx** field. idx field values start from 1. Also all my docs has **duration** field. They are also number. It can vary from 900 to 1000. I want to visualize last 10 (according to idx) docs' duration with line chart on Kibana.

- Docs can be inserted anytime. So my total doc count is not fixed.
- idx increment is 1.
- if I have 40 docs, x-axis should start from 31 and end with 40. If I have 100 docs x-axis should start from 91 and end with 100, etc...

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [April 26, 2019, 10:36pm UTC](https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717/2 "2019-04-26T22:36:39Z")

</div>

Hey @Sabri_Mutlucag, we can get pretty close to what you're looking for using a vertical bar chart and a few tricks. Kibana's visualizations are based on aggregates, and they aren't geared around visualizing individual documents. With that being said, since we have the `idx` field which is a unique value, if we create a terms aggregate using the `idx` each document will end up in its own bucket.

![24%20PM](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4cbc835e5d2f044d7d482d0fc3219843813b8e0b.png)

---

<div class="post-metadata">

**Author:** ![Sabri\_Mutlucag](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@Sabri\_Mutlucag](https://discuss.elastic.co/u/Sabri_Mutlucag)\
**Post date:** [April 27, 2019, 7:27am UTC](https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717/3 "2019-04-27T07:27:25Z")

</div>

Thanks for reply @Brandon_Kobel. But it orders x axis value from last/max id to (max-5) id - 1st Image. I want to order from (max-5) id to max - 2nd image.

- 1st image  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/a/cacc19ef8cfce115fc4ca4835ab544120e39a32b.png)
- 2nd image  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/60abdaf2efd97d2261bc9ef59b960b85b8eb093a.png)

---

<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 25, 2019, 7:27am UTC](https://discuss.elastic.co/t/show-last-n-records-in-kibana-ascending-order/178717/4 "2019-05-25T07:27:33Z")

</div>

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