# How to display a date as a date, not a long, in a terms panel?

**URL:** <https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584>\
**Category:** Kibana\
**Created:** [July 30, 2015, 4:29pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584 "2015-07-30T16:29:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Neal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_neal/32/3527_2.png) [@Chris\_Neal](https://discuss.elastic.co/u/Chris_Neal)\
**Post date:** [July 30, 2015, 4:29pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/1 "2015-07-30T16:29:50Z")

</div>

Hi all,

I have a mapped field called 'start\_date' that I want to display in a terms panel as a "human readable" date string, not a long. Is this possible? I did a search through this group and didn't see the question asked, so hopefully it's not a repeat!

Mapping:  
"start\_date": { "type": "date", "index" : "not\_analyzed", "doc\_values": true, "norms": { "enabled": false } }

Query:

```
curl -XGET 'http://myhost:9200/myindex-20150729/_search?pretty' -d '{
  "facets": {
    "terms": {
      "terms": {
        "field": "start_date",
        "size": 10,
        "order": "count",
        "exclude": []
      },
      "facet_filter": {
        "fquery": {
          "query": {
            "filtered": {
              "query": {
                "bool": {
                  "should": [
                    {
                      "query_string": {
                        "query": "(process:Batch) AND (process_result:Fail)"
                      }
                    }
                  ]
                }
              },
              "filter": {
                "bool": {
                  "must": [
                    {
                      "range": {
                        "@timestamp": {
                          "from": 1438186360290,
                          "to": 1438272760290
                        }
                      }
                    },
                    {
                      "fquery": {
                        "query": {
                          "query_string": {
                            "query": "_type:perf_myapp"
                          }
                        },
                        "_cache": true
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "size": 0
}'

```

Result:

```
{
  "took" : 5330,
  "timed_out" : false,
  "_shards" : {
    "total" : 12,
    "successful" : 12,
    "failed" : 0
  },
  "hits" : {
    "total" : 1096575744,
    "max_score" : 0.0,
    "hits" : []
  },
  "facets" : {
    "terms" : {
      "_type" : "terms",
      "missing" : 0,
      "total" : 39376,
      "other" : 16614,
      "terms" : [ {
        "term" : 1438128000000,
        "count" : 4164
      }, {
        "term" : 1438041600000,
        "count" : 3781
      }, {
        "term" : 1438214400000,
        "count" : 3179
      }, {
        "term" : 1437955200000,
        "count" : 2612
      }, {
        "term" : 1438300800000,
        "count" : 2117
      }, {
        "term" : 1439337600000,
        "count" : 1677
      }, {
        "term" : 1437782400000,
        "count" : 1443
      }, {
        "term" : 1437868800000,
        "count" : 1374
      }, {
        "term" : 1438732800000,
        "count" : 1243
      }, {
        "term" : 1437696000000,
        "count" : 1172
      } ]
    }
  }
}

```

Thank you so much for the advice!  
Chris

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 31, 2015, 4:43am UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/2 "2015-07-31T04:43:47Z")

</div>

Why are you using facets?

ES stores everything as unix epoch time under the hood and it should convert this back to ISO8601 when it returns the values.

---

<div class="post-metadata">

**Author:** ![Chris\_Neal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_neal/32/3527_2.png) [@Chris\_Neal](https://discuss.elastic.co/u/Chris_Neal)\
**Post date:** [July 31, 2015, 1:58pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/3 "2015-07-31T13:58:22Z")

</div>

Hi Mark,

Well, the short answer is "because that's what Kibana generated." 😄

I'm trying to help another user who is building a panel that looks like this:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/2/2ab04208a5a0abbbc6a22d1b3077ec1272c89f3d.png)

to show failure counts by day. Is there a better way to do this that will not use the long representation of the date?

Many thanks as usual.  
Chris

---

<div class="post-metadata">

**Author:** ![Chris\_Neal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_neal/32/3527_2.png) [@Chris\_Neal](https://discuss.elastic.co/u/Chris_Neal)\
**Post date:** [August 3, 2015, 2:23pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/4 "2015-08-03T14:23:03Z")

</div>

Just following up on this one. I'm curious if there is another/better way to accomplish this?

Thank you so much!  
Chris

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [August 5, 2015, 5:50am UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/5 "2015-08-05T05:50:56Z")

</div>

Hey Chris - I can reproduce this in K3, but not in K4 against the same dataset. From this thread, it looks like in K3 you have to index a readable timestamp as a string as a workaround: [http://stackoverflow.com/questions/28466816/kibana-to-display-timestamp-field-into-a-readable-format](http://stackoverflow.com/questions/28466816/kibana-to-display-timestamp-field-into-a-readable-format)

However, K4 allows you to specify a date format in Settings and does the sane thing OOB. Have you considered using the new version?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/ce2d3ab42b502ecd8556010b13b7332a75f85f70.png)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1b0f659cda921cc999ccc6897705ff2749966f43.png)

---

<div class="post-metadata">

**Author:** ![Chris\_Neal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_neal/32/3527_2.png) [@Chris\_Neal](https://discuss.elastic.co/u/Chris_Neal)\
**Post date:** [August 5, 2015, 1:33pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/6 "2015-08-05T13:33:09Z")

</div>

Thank you Tanya!

I do have K4 in a Dev environment right now, so I'll check there and make sure I can get the format like I need it there, and try and create a string format of the date field and get that working in K3.

Again, thank you so much for your time!  
Chris

---

<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:** [July 6, 2017, 2:15pm UTC](https://discuss.elastic.co/t/how-to-display-a-date-as-a-date-not-a-long-in-a-terms-panel/26584/7 "2017-07-06T14:15:14Z")

</div>


