Skip to content

Dates formatted as epoch_millis are returned as strings instead of numbers #50622

@nreese

Description

@nreese

Steps to expose problem:

  1. install Kibana's web logs sample data set.
  2. In Kibana 's console, run the following
GET kibana_sample_data_logs/_search
{
  "docvalue_fields": [
    {
      "field": "@timestamp",
      "format": "epoch_millis"
    }
  ],
  "size": 10,
  "_source": false,
  "query": {
    "match_all": {}
  }
}

In the response, notice how @timestamp is returned as a string instead of a number

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "kibana_sample_data_logs",
        "_id" : "CrmEZm8Bs4SbvGEZjlv8",
        "_score" : 1.0,
        "fields" : {
          "@timestamp" : [
            "1576975142912"
          ]
        }
      },
      {
        "_index" : "kibana_sample_data_logs",
        "_id" : "C7mEZm8Bs4SbvGEZjlv8",
        "_score" : 1.0,
        "fields" : {
          "@timestamp" : [
            "1576985181326"
          ]
        }
      },

The expected behavior would be to return epoch_millis as a number since its a numerical value. Javascript's Number.MAX_SAFE_INTEGER is 9007199254740991 which is approximately 285,616 years, either forward or backward, from 01 January, 1970. This should ensure that epoch_millis stored as a Java Long will not overflow a javascript number.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions