# Convert cloudflare unix nanoseconds timestamp to elastic search date time field

**URL:** https://discuss.elastic.co/t/convert-cloudflare-unix-nanoseconds-timestamp-to-elastic-search-date-time-field/149409
**Category:** Elasticsearch
**Created:** [September 21, 2018, 7:47am UTC](https://discuss.elastic.co/t/convert-cloudflare-unix-nanoseconds-timestamp-to-elastic-search-date-time-field/149409 "2018-09-21T07:47:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Palanikumark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/palanikumark/32/27297_2.png) [@Palanikumark](https://discuss.elastic.co/u/Palanikumark)
#### Post date: [September 21, 2018, 7:47am UTC](https://discuss.elastic.co/t/convert-cloudflare-unix-nanoseconds-timestamp-to-elastic-search-date-time-field/149409/1 "2018-09-21T07:47:09Z")

</div>

Hi Team,

Im facing trouble in converting unix nanoseconds to elastic search date time field. Please let me know how to create indices and import this data.

```
{
 "mappings": {
  "doc": {
   "properties": {
    "CacheCacheStatus": {"type": "string"},
	"CacheResponseBytes": {"type": "integer"},
	"CacheResponseStatus": {"type": "integer"},
	"CacheTieredFill":{"type": "boolean"},
        "EdgeStartTimestamp": {"type": "date"}
      }
  }
 }
}

```

**Data**

```
{"index":{"_index":"cloudflare-2018.09.01","_type":"log"}}
{"CacheCacheStatus":"unknown","CacheResponseBytes":32707,"CacheResponseStatus":200,"CacheTieredFill":false,"EdgeStartTimestamp":1535759910756000000}
{"index":{"_index":"cloudflare-2018.09.01","_type":"log"}}
{"CacheCacheStatus":"unknown","CacheResponseBytes":42537,"CacheResponseStatus":200,"CacheTieredFill":false,"EdgeStartTimestamp":1535759912213999872}

```

While importing into elastic search im getting below error.

```
{
    "create" : {
      "_index" : "cloudflare-2018.09.01",
      "_type" : "log",
      "_id" : "AWX7EQH50J_kGrzSCN-5",
      "status" : 400,
      "error" : {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse [EdgeStartTimestamp]",
        "caused_by" : {
          "type" : "illegal_argument_exception",
          "reason" : "Invalid format: \"1535759912620000000\" is malformed at \"759912620000000\""
        }
```

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [September 28, 2018, 11:05am UTC](https://discuss.elastic.co/t/convert-cloudflare-unix-nanoseconds-timestamp-to-elastic-search-date-time-field/149409/2 "2018-09-28T11:05:03Z")

</div>

Hey,

Elasticsearch does not yet have support for timestamps in nanosecond resolution. You could use an ingest pipeline to shorten the date accordingly, so that it fits within millisecond resolution.

--Alex

---

<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: [October 26, 2018, 11:05am UTC](https://discuss.elastic.co/t/convert-cloudflare-unix-nanoseconds-timestamp-to-elastic-search-date-time-field/149409/3 "2018-10-26T11:05:05Z")

</div>

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