# How to remove the default January 1st 1970 in time

**URL:** <https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159>\
**Category:** Elasticsearch\
**Created:** [January 7, 2019, 7:43am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159 "2019-01-07T07:43:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![talon](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@talon](https://discuss.elastic.co/u/talon)\
**Post date:** [January 7, 2019, 7:43am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/1 "2019-01-07T07:43:43Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 7, 2019, 8:14am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/2 "2019-01-07T08:14:20Z")

</div>

Why not just using a `keyword` in that case?

```auto
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"
}

```

---

<div class="post-metadata">

**Author:** ![talon](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@talon](https://discuss.elastic.co/u/talon)\
**Post date:** [January 7, 2019, 8:20am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/3 "2019-01-07T08:20:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 7, 2019, 9:50am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/4 "2019-01-07T09:50:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![talon](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@talon](https://discuss.elastic.co/u/talon)\
**Post date:** [January 7, 2019, 11:54am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/5 "2019-01-07T11:54:56Z")

</div>

| 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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 8, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/6 "2019-01-08T09:45:03Z")

</div>

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

---

<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:** [February 5, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-to-remove-the-default-january-1st-1970-in-time/163159/7 "2019-02-05T09:45:04Z")

</div>

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