# Elasticsearch issue when indexing nanoseconds

**URL:** https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345
**Category:** Elasticsearch
**Created:** [February 1, 2024, 11:42pm UTC](https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345 "2024-02-01T23:42:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kannan\_raj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kannan_raj/32/63201_2.png) [@kannan\_raj](https://discuss.elastic.co/u/kannan_raj)
#### Post date: [February 1, 2024, 11:42pm UTC](https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345/1 "2024-02-01T23:42:53Z")

</div>

Hi Team,

Could not able to index the nanaseconds?

```auto
PUT _template/datenanos
{
  "index_patterns": ["datenanos"],
  "mappings": {
    "properties": {
      "timestamp": {
        "type": "date_nanos"
      }
    }
  }
}

POST datenanos/_doc
{
  "timestamp": 1706750418126671600
}

```

`1706817016659228000` is `Thursday, February 1, 2024 7:50:16.659 PM` in GMT

```auto
Error
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse field [timestamp] of type [date_nanos] in document with id 'wR8KZ40BsAu17u8DfBwZ'. Preview of field's value: '1706750418126671600'"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse field [timestamp] of type [date_nanos] in document with id 'wR8KZ40BsAu17u8DfBwZ'. Preview of field's value: '1706750418126671600'",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "date[+54086737-09-12T08:31:11.600Z] is after 2262-04-11T23:47:16.854775807 and cannot be stored in nanosecond resolution"
    }
  },
  "status" : 400
}

```

---

<div class="post-metadata">

### Author: ![strawgate](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/strawgate/32/131008_2.png) [@strawgate](https://discuss.elastic.co/u/strawgate)
#### Post date: [February 2, 2024, 2:30pm UTC](https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345/2 "2024-02-02T14:30:00Z")

</div>

> [@kannan\_raj](#):
>
> `date_nanos`

The default formatting for date types is `strict_date_optional_time_nanos||epoch_millis`

I don't believe there is a supported epoch\_nanos format so it's passing your timestamp as a millisecond base epoch timestamp.

You'll want to provide dates in `strict_date_optional_time_nanos` format like `yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ`

See: [date\_nanos does't work for 19 symbols nanoseconds · Issue #43917 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/43917)

That ticket is closed so if you'd like to see epoch\_nanos I'd recommend filling a feature request in that repository or if you are an elastic customer contacting your account team to file an enhancement request.

---

<div class="post-metadata">

### Author: ![kannan\_raj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kannan_raj/32/63201_2.png) [@kannan\_raj](https://discuss.elastic.co/u/kannan_raj)
#### Post date: [February 2, 2024, 7:57pm UTC](https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345/3 "2024-02-02T19:57:32Z")

</div>

Thank you @strawgate for the details information.

---

<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: [March 1, 2024, 7:58pm UTC](https://discuss.elastic.co/t/elasticsearch-issue-when-indexing-nanoseconds/352345/4 "2024-03-01T19:58:31Z")

</div>

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