# Date format error when splitting a chart with date histogram

**URL:** <https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238>\
**Category:** Kibana\
**Created:** [September 19, 2019, 2:44pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238 "2019-09-19T14:44:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![parosio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parosio/32/27367_2.png) [@parosio](https://discuss.elastic.co/u/parosio)\
**Post date:** [September 19, 2019, 2:44pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/1 "2019-09-19T14:44:27Z")

</div>

Hello,  
I'm currently using 6.7

If I create a visualization (either a pie or a histogram) and split it with a Date histogram aggregation, the axis labels are not formatted (key in millisec is shown), while the tooltip correctly shows only the year (or the appropriate date format).

![20190919_SplitChartDateHist](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1a4095af54af8991ac63556ada670aedbedde71f.png)

(BTW, testing it on [[elastic demo]](https://demo.elastic.co/app/kibana#/visualize/create?type=horizontal_bar&savedSearchId=Apache-access-logs-ecs&_g=()&_a=(filters:!(),linked:!t,query:(language:kuery,query:''),uiState:(),vis:(aggs:!((enabled:!t,id:'1',params:(),schema:metric,type:count),(enabled:!t,id:'2',params:(drop_partials:!f,extended_bounds:(),field:'@timestamp',interval:'2m',min_doc_count:1,row:!t,timeRange:(from:now-15m,to:now),useNormalizedEsInterval:!t),schema:split,type:date_histogram)),params:(addLegend:!t,addTimeMarker:!f,addTooltip:!t,categoryAxes:!((id:CategoryAxis-1,labels:(filter:!f,rotate:0,show:!t,truncate:200),position:left,scale:(type:linear),show:!t,style:(),title:(),type:category)),dimensions:(splitRow:!((accessor:0,aggType:date_histogram,format:(id:date,params:(pattern:'HH:mm:ss')),params:())),x:!n,y:!((accessor:1,aggType:count,format:(id:number),params:()))),grid:(categoryLines:!f),legendPosition:right,seriesParams:!((data:(id:'1',label:Count),drawLinesBetweenPoints:!t,mode:normal,show:!t,showCircles:!t,type:histogram,valueAxis:ValueAxis-1)),times:!(),type:histogram,valueAxes:!((id:ValueAxis-1,labels:(filter:!t,rotate:75,show:!t,truncate:100),name:LeftAxis-1,position:bottom,scale:(mode:normal,type:linear),show:!t,style:(),title:(text:Count),type:value))),title:'',type:histogram))) the situation is the opposite: the axis label is well-formatted, while in the tooltip it's shown in millisec).

Is it there any way to show the formatted key value (the date) also on axis label (maybe using the json input)?

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [September 19, 2019, 7:36pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/2 "2019-09-19T19:36:29Z")

</div>

Date field values should be formatted by default. I would guess that there's a mapping issue here. A few questions:

- What does the mapping look like for your `@timestamp` field in your Elasticsearch indices?
- If you look at your index pattern in the Kibana Management app, is the field listed as a date field?
- Have you applied a custom date format for that field in your index pattern configuration?

---

<div class="post-metadata">

**Author:** ![parosio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parosio/32/27367_2.png) [@parosio](https://discuss.elastic.co/u/parosio)\
**Post date:** [September 23, 2019, 12:43pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/3 "2019-09-23T12:43:16Z")

</div>

Hello Matt,  
thank you for your interest;

in order:

- `"@timestamp": { "type": "date" }` for all the indices included in the kibana pattern
- Yes, it's a date type field and is also the field used as for Time Filtering
- No, in kibana it has the `- Default -` Format (`Date`)

Maybe it's not clear enough from the image I posted before, but this behavior only occurs when I use a Date Histogram aggregation in **Split Chart** , not in Axis or Split Series.

 ![20190923_SplitChartDate2](https://us1.discourse-cdn.com/elastic/original/3X/2/7/27613f966a5179bb13d56738e6fad899b0dfe27c.png)

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [September 25, 2019, 7:48pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/4 "2019-09-25T19:48:29Z")

</div>

Hmm I tried to reproduce in 6.7.2 but I wasn't able to:

 ![26%20PM](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a49ca49163f83fcdbb4b550b97ccd9b17be225d5.png)

Could you click the "Inspect" button in the top menu, select "View: Requests" in the top right of the flyout, and click the Response tab? What does the info for one of the top level date histogram buckets look like? I see something like this:

```auto
"key_as_string": "2016-01-01T00:00:00.000-05:00",
"key": 1451624400000,
"doc_count": 21

```

---

<div class="post-metadata">

**Author:** ![parosio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parosio/32/27367_2.png) [@parosio](https://discuss.elastic.co/u/parosio)\
**Post date:** [September 26, 2019, 8:47am UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/5 "2019-09-26T08:47:50Z")

</div>

Hi Matt,

the result is quite the same on my side:

```
"3": {
  "buckets": [
    {
      "key_as_string": "2019-09-25T00:00:00.000+02:00",
      "key": 1569362400000,
      "doc_count": 183
    },
    {
      "key_as_string": "2019-09-26T00:00:00.000+02:00",
      "key": 1569448800000,
      "doc_count": 37
    }
  ]
}

```

 ![20190923_SplitChartDate3](https://us1.discourse-cdn.com/elastic/original/3X/3/d/3de0fa4f11ba1564c9a5ce817b3f22b350d41f7f.png)

Only difference I'm using 6.7.0.  
Reading through the release notes I don't find anything specific to this, but I assume it could have been fixed between 6.7.0 and 6.7.2.

Thank you again,  
Paolo

---

<div class="post-metadata">

**Author:** ![parosio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parosio/32/27367_2.png) [@parosio](https://discuss.elastic.co/u/parosio)\
**Post date:** [September 26, 2019, 12:53pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/6 "2019-09-26T12:53:28Z")

</div>

Hello,

this only to confirm that the issue is not present in 6.7.2.

 ![20190923_SplitChartDate4](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b3dc790bba93ebfaa3b48e234c21d8b470c2be5b.png)

Regards,  
Paolo

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [September 26, 2019, 9:47pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/7 "2019-09-26T21:47:30Z")

</div>

Thanks for circling back! It must have been fixed as a side effect of another change.

---

<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:** [October 24, 2019, 9:47pm UTC](https://discuss.elastic.co/t/date-format-error-when-splitting-a-chart-with-date-histogram/200238/8 "2019-10-24T21:47:30Z")

</div>

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