# Date\_time\_exception: Field Year cannot be printed as the value -292275055 exceeds the maximum print width of 4\]

**URL:** <https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900>\
**Category:** Elasticsearch\
**Created:** [November 14, 2022, 7:28pm UTC](https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900 "2022-11-14T19:28:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hchen1](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@hchen1](https://discuss.elastic.co/u/hchen1)\
**Post date:** [November 14, 2022, 7:28pm UTC](https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900/1 "2022-11-14T19:28:48Z")

</div>

I got date\_time\_exception after disabling dynamic mapping and adding mapping for a Date attribute like this:

```auto
"mappings": {
    "dynamic": false,
  ........

  "updateDate": {
                "type": "date",
                "format": "date_hour_minute_second_millis",
                "null_value": ""
              },
....
}

```

then I got exception:

```auto
Caused by: NotSerializableExceptionWrapper[: Field Year cannot be printed as the value -292275055 exceeds the maximum print width of 4]; nested: NotSerializableExceptionWrapper[date_time_exception: Field Year cannot be printed as the value -292275055 exceeds the maximum print width of 4];
    at org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:639)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:398)
    ... 44 more
Caused by: NotSerializableExceptionWrapper[date_time_exception: Field Year cannot be printed as the value -292275055 exceeds the maximum print width of 4]
    at java.time.format.DateTimeFormatterBuilder$NumberPrinterParser.format(DateTimeFormatterBuilder.java:2916)
    at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2525)
    at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2525)
    at java.time.format.DateTimeFormatter.formatTo(DateTimeFormatter.java:1903)
    at java.time.format.DateTimeFormatter.format(DateTimeFormatter.java:1877)
    at org.elasticsearch.common.time.JavaDateFormatter.format(JavaDateFormatter.java:284)
    at org.elasticsearch.search.DocValueFormat$DateTime.format(DocValueFormat.java:303)
    at org.elasticsearch.search.DocValueFormat$DateTime.format(DocValueFormat.java:216)
    at org.elasticsearch.search.SearchSortValuesAndFormats.<init>(SearchSortValuesAndFormats.java:35)
    at org.elasticsearch.action.search.BottomSortValuesCollector.consumeTopDocs(BottomSortValuesCollector.java:65)
    at org.elasticsearch.action.search.SearchQueryThenFetchAsyncAction.onShardResult(SearchQueryThenFetchAsyncAction.java:130)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.innerOnResponse(AbstractSearchAsyncAction.java:320)
    ... 40 more

```

are there anyone get such problem before or know what the problem is? Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 15, 2022, 6:03am UTC](https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900/2 "2022-11-15T06:03:29Z")

</div>

Welcome to our community! 😃

Are you adding this mapping to a new index? Or are you trying to update an existing mapping?  
If you are adding this to a new one, are you getting this when you add data in? Can you share the data?

Also lease format your code/logs/config using the `</>` button, or markdown style back ticks. It helps to make things easy to read which helps us help you 🙂

---

<div class="post-metadata">

**Author:** ![hchen1](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@hchen1](https://discuss.elastic.co/u/hchen1)\
**Post date:** [November 15, 2022, 6:15pm UTC](https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900/3 "2022-11-15T18:15:28Z")

</div>

Thanks for your reply, Mark. This is an exiting index. We didn't claim 'dynamic=false' before and we used following mapping for a 'date' field, everything worked fine.

```auto
"updateDate": {
"type": "date",
"format": "date_hour_minute_second_millis",
"null_value": ""
},

```

We recently explicitly claim 'dynamic=false' and the mapping for 'updateDate' still the same, but got exception:

`Caused by: NotSerializableExceptionWrapper[: Field Year cannot be printed as the value -292275055 exceeds the maximum print width of 4]`

This error happened when we use sorting by 'updateDate' in a query. I can't share the data as I don't even know which doc has the 'bad' year and hundred of thousands docs were involved in the query. But for sure, we didn't get error before we explicitly claimed 'dynamic=false'.

---

<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:** [December 13, 2022, 6:15pm UTC](https://discuss.elastic.co/t/date-time-exception-field-year-cannot-be-printed-as-the-value-292275055-exceeds-the-maximum-print-width-of-4/318900/4 "2022-12-13T18:15:50Z")

</div>

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