# Pie chart top hit metrics doesn't allow sort by timestamp

**URL:** <https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937>\
**Category:** Kibana\
**Created:** [July 5, 2020, 11:53pm UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937 "2020-07-05T23:53:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kayla\_Vo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kayla_vo/32/49985_2.png) [@Kayla\_Vo](https://discuss.elastic.co/u/Kayla_Vo)\
**Post date:** [July 5, 2020, 11:53pm UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/1 "2020-07-05T23:53:59Z")

</div>

I am using Amazon Elasticsearch 7.4 to create a pie chart for the last value of each category.  
The logs look like this:

```auto
    {
        "@timestamp": 1593750007582,
        "type": "roommode",
        "name": "Off",
        "room_quantity": 8
    }

```

I use "Top Hit" metrics to get the last "room\_quantity", and split the bucket by "name".  
However, I can't see the option to sort by @timestamp, if I enter @timestamp manually it will trigger an error.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/2/829348c05643ee58e4dc9c55440eb2cc1cbb0b49.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [July 6, 2020, 2:00pm UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/2 "2020-07-06T14:00:49Z")

</div>

Hey @Kayla_Vo, welcome to the discussion boards.

I believe this is something that should work. What does your `innoedge-transformed*` index pattern look like? Specifically, what data type does Kibana _think_ `@timestamp` should be? It's possible that it's interpreting this as a different field type which isn't sortable

---

<div class="post-metadata">

**Author:** ![Kayla\_Vo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kayla_vo/32/49985_2.png) [@Kayla\_Vo](https://discuss.elastic.co/u/Kayla_Vo)\
**Post date:** [July 6, 2020, 10:37pm UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/3 "2020-07-06T22:37:24Z")

</div>

Hi Larry ☀  
I setup the index mappings before I push data into the index.  
The mappings look like this:

```auto
{
  "innoedge-transformed-000001" : {
    "mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "name" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "room_quantity" : {
          "type" : "long"
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    }
  }
}

```

It says `@timestamp` is `date` so I'm not sure what's causing the issue here.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [July 7, 2020, 12:02am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/4 "2020-07-07T00:02:59Z")

</div>

Sorry I should have been more specific. In Kibana, you should have an index pattern created which corresponds to the underlying Elasticsearch index. The mapping you provided is for the underlying index, but I'm interested to see what Kibana's corresponding Index Pattern looks like. You can view this by going to Stack Management -\> Index Patterns, and then clicking on the name of your index pattern to view details. Does yours also show `@timestamp` as a date?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1bf4f344b7b3c5e079cee8f8fd16c4d57ddd83d8.png)

---

<div class="post-metadata">

**Author:** ![Kayla\_Vo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kayla_vo/32/49985_2.png) [@Kayla\_Vo](https://discuss.elastic.co/u/Kayla_Vo)\
**Post date:** [July 7, 2020, 12:18am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/5 "2020-07-07T00:18:24Z")

</div>

Hi Larry, this is what it looks like under Index Patterns:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/2/d25dbf62f0eb153e2552ff227239da888e24f795.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [July 7, 2020, 12:51am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/6 "2020-07-07T00:51:10Z")

</div>

Thanks for the screenshot. Hmm, as you've been trying to tell me, everything here looks to be configured correctly 😄. Thanks for your patience.

I'm going to ask around to see if anyone has seen this before. You mentioned that entering `@timestamp` manually is triggering an error. What error are you seeing when you attempt this?

---

<div class="post-metadata">

**Author:** ![Kayla\_Vo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kayla_vo/32/49985_2.png) [@Kayla\_Vo](https://discuss.elastic.co/u/Kayla_Vo)\
**Post date:** [July 7, 2020, 1:44am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/7 "2020-07-07T01:44:37Z")

</div>

Sorry my bad it's not actually an error it's just an odd behaviour.  
I can manually type `@timestamp` into the sort by field, and can still save the chart (there's the red underline).  
However when I reload the chart again it will still show sort by `room_quantity`

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e255691f691b8478390c729f10e3a28a51486641.png)

---

<div class="post-metadata">

**Author:** ![Kayla\_Vo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kayla_vo/32/49985_2.png) [@Kayla\_Vo](https://discuss.elastic.co/u/Kayla_Vo)\
**Post date:** [July 8, 2020, 3:05am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/8 "2020-07-08T03:05:15Z")

</div>

Hi @Larry_Gregory, just wanted to follow up on this issue.  
Did you have a chance to look into it?

---

<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 5, 2020, 3:05am UTC](https://discuss.elastic.co/t/pie-chart-top-hit-metrics-doesnt-allow-sort-by-timestamp/239937/9 "2020-08-05T03:05:19Z")

</div>

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