How to remove the default January 1st 1970 in time

HI
How to remove the default January 1st 1970 in time.

PUT range_index
{
  "settings": {
    "number_of_shards": 2
  },
  "mappings": {
    "_doc": {
      "properties": {
        "expected_attendees": {
          "type": "integer_range"
        },
        "time": {
          "type": "date"
        },
        "time_frame": {
          "type": "date", 
          "format": "hour_minute_second_fraction",
          "fields": {
            "raw": { 
              "type":  "keyword"
            }
          }
        }
      }
    }
  }
}

PUT range_index/_doc/1
{
    "time":"2019-01-07T06:23:04.588Z",
    "time_frame" : "14:12:12.123"
}

when time_frame show is January 1st 1970, 22:12:12.123, but i want it to be 22:12:12.123

Why not just using a keyword in that case?

PUT range_index
{
  "mappings": {
    "_doc": {
      "properties": {
        "expected_attendees": {
          "type": "integer_range"
        },
        "time": {
          "type": "date"
        },
        "time_frame": {
           "type":  "keyword"
        }
      }
    }
  }
}

PUT range_index/_doc/1
{
    "time":"2019-01-07T06:23:04.588Z",
    "time_frame" : "14:12:12.123"
}

yes, if we use keyword,it will show as "14:12:12.123", but we need use it to do some Aggregation such as Order By time_frame, so we can't use keyword

How are you going to aggregate by time frame with a date field if day is always 1/1/1971?

I'm not sure about what your exact use case is.

Partition Path MaxTimeSinceEnqueued
21 hotpath January 1st 1970, 00:00:02.559
2 $Default January 1st 1970, 00:00:03.829
3 $Default January 1st 1970, 00:00:06.751
7 $Default January 1st 1970, 00:00:06.858
22 $Default January 1st 1970, 00:00:18.776
18 $Default January 1st 1970, 00:00:21.425
24 hotpath January 1st 1970, 00:00:22.563
28 hotpath January 1st 1970, 00:00:25.147
19 $Default January 1st 1970, 00:00:27.265
18 hotpath January 1st 1970, 00:00:27.309

MaxTimeSinceEnqueued is a time interval, not a moment, and we need order by this data field

Why not a number which represents the number of seconds (elapsed) or something like this?

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