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

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

    {
        "@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.

1 Like

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

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

{
  "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.

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?

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

Thanks for the screenshot. Hmm, as you've been trying to tell me, everything here looks to be configured correctly :smile:. 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?

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

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

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