# How to set max bucket in canvas?

**URL:** <https://discuss.elastic.co/t/how-to-set-max-bucket-in-canvas/209058>\
**Category:** Kibana\
**Created:** [November 22, 2019, 11:54am UTC](https://discuss.elastic.co/t/how-to-set-max-bucket-in-canvas/209058 "2019-11-22T11:54:50Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [November 26, 2019, 1:57am UTC](https://discuss.elastic.co/t/how-to-set-max-bucket-in-canvas/209058/3 "2019-11-26T01:57:55Z")

</div>

I want to count the number every second to get the maximum count.  
So i'm trying to group by my\_date\_field.

SELECT SUBSTR(CONCAT(TO\_CHAR(my\_date\_field)),4), COUNT(\*) FROM "my\_index\_name" GROUP BY SUBSTR(CONCAT(TO\_CHAR(my\_date\_field)),4)

but TO\_CHAR is unknown function...  
and i show like this..

> [@Date format parsing exception](https://discuss.elastic.co/t/date-format-parsing-exception/100892):
>
> I have create\_date column as timestamp in database and need create\_date value in elastic as "MM/DD/YYYY" or "yyyy-MM-dd" . I am getting below error exception while loading data from oracle database using logstash 2.4. SQL: select to\_date(to\_char(cast(create\_date as date),'MM/DD/YYYY') ,'MM/DD/YYYY') from table X. exception. "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse [create\_date]", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"In…

my\_date\_field format is strict\_date\_time(yyy-MM-dd'T'HH:mm:ss.SSSZZ).

how can i set to get max records?

---

_[View the full topic](https://discuss.elastic.co/t/how-to-set-max-bucket-in-canvas/209058)._
