# How bucket the count into per second

**URL:** <https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774>\
**Category:** Kibana\
**Created:** [July 5, 2021, 6:49am UTC](https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774 "2021-07-05T06:49:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![missylearner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/missylearner/32/91142_2.png) [@missylearner](https://discuss.elastic.co/u/missylearner)\
**Post date:** [July 5, 2021, 6:49am UTC](https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774/1 "2021-07-05T06:49:30Z")

</div>

Anyone knows how to query in the script to bucket the counts into seconds. because in kibana if we filter timestamp of the count by seconds it will automatically scale to 5 seconds.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [July 5, 2021, 8:00am UTC](https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774/2 "2021-07-05T08:00:09Z")

</div>

In Lens there's an easy way to do this - it's called "Normalize per unit" in the "advanced options":

 ![Screenshot 2021-07-05 at 09.58.56](https://us1.discourse-cdn.com/elastic/original/3X/4/8/488b5c63607dcc9aace531af9e45edebc0838494.png)

 ![Screenshot 2021-07-05 at 09.59.03](https://us1.discourse-cdn.com/elastic/original/3X/7/2/726b638387b02758fea787bd1206ad5c96113aa3.png)

It will show the count in the chart scaled per second no matter the underlying date histogram interval.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [July 5, 2021, 11:21am UTC](https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774/4 "2021-07-05T11:21:43Z")

</div>

Is this a Kibana related question? If you are building raw Elasticsearch queries and use them outside of Kibana, it's probably better to ask this question in the Elasticsearch forum instead.

On this level, the `rate` aggregation is probably what you are looking for: [Rate aggregation | Elasticsearch Guide [7.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-rate-aggregation.html)

---

<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:** [August 2, 2021, 11:22am UTC](https://discuss.elastic.co/t/how-bucket-the-count-into-per-second/277774/5 "2021-08-02T11:22:37Z")

</div>

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