# Field Year cannot be printed as the value 292278994 exceeds the maximum print width of 4

**URL:** <https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581>\
**Category:** Elasticsearch\
**Created:** [May 27, 2025, 10:46am UTC](https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581 "2025-05-27T10:46:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)\
**Post date:** [May 27, 2025, 10:46am UTC](https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581/1 "2025-05-27T10:46:21Z")

</div>

I am using elasticsearch 7.17.6

I am getting "Field Year cannot be printed as the value 292278994 exceeds the maximum print width of 4" error when I try to sort by RegistrationDate. The strange thing is that I get this when I exclude the records with RegistrationDate so remaining documents dont have that field. What is more strange is that when I change the page size to 1 or 2 then it fails but when I increase it to big number or remove it succeeds.

My index contains:

```auto
"RegistrationDate": {
  "type": "date",
  "format": "strict_date_time||strict_date_time_no_millis||epoch_millis"
},

```

and my query is:

```auto
POST _search
{
  "size": 2,
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "RegistrationDate"
          }
        }
      ]
    }
  },
  "sort": [
    {
      "RegistrationDate": {
        "order": "asc"
      }
    }
  ]
}

```

---

<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:** [May 27, 2025, 11:20am UTC](https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581/2 "2025-05-27T11:20:53Z")

</div>

I just tested on Serverless (which is running something like a 9.1 version) and I can not reproduce:

```auto
DELETE test
PUT test
{
  "mappings": {
    "properties": {
      "RegistrationDate": {
        "type": "date",
        "format": "strict_date_time||strict_date_time_no_millis||epoch_millis"
      }
    }
  }
}
POST test/_doc
{
    "foo": "bar"
}
POST test/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "RegistrationDate"
          }
        }
      ]
    }
  },
  "sort": [
    {
      "RegistrationDate": {
        "order": "asc"
      }
    }
  ]
}

```

It gives:

```auto
{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": null,
    "hits": [
      {
        "_index": "test",
        "_id": "0u53EZcBRTNM3AEhp97N",
        "_score": null,
        "_source": {
          "foo": "bar"
        },
        "sort": [
          9223372036854776000
        ]
      }
    ]
  }
}

```

Could you share a full example as I just did and try it in 8.18 at least?

---

<div class="post-metadata">

**Author:** ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)\
**Post date:** [May 27, 2025, 12:57pm UTC](https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581/3 "2025-05-27T12:57:08Z")

</div>

Thanks, I tried your example and got the exception when I add the size = 1.

---

<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:** [May 27, 2025, 5:40pm UTC](https://discuss.elastic.co/t/field-year-cannot-be-printed-as-the-value-292278994-exceeds-the-maximum-print-width-of-4/378581/4 "2025-05-27T17:40:03Z")

</div>

Thanks!

I can reproduce it with the latest version:

```auto
DELETE test
PUT test
{
  "mappings": {
    "properties": {
      "RegistrationDate": {
        "type": "date",
        "format": "strict_date_time"
      }
    }
  }
}
POST test/_doc
{
    "foo": "bar"
}
POST test/_search
{
  "size": 1,
  "sort": [
    {
      "RegistrationDate": {
        "order": "asc"
      }
    }
  ]
}

```

Note that this is not happening when you don't set the date format.

I can see that the following issue has been opened:

> <https://github.com/elastic/elasticsearch/issues/125321>
>
> \### Elasticsearch Version
> 
> 8.17.2
> 
> \### Installed Plugins
> 
> non
> 
> \### Java Version
> …
> \_bundled\_
> 
> \### OS Version
> 
> docker 8.17.2
> 
> \### Problem Description
> 
> When sort by date field, which is not required we have arithmetic exception. 
> Help only add "missing": Long.MAX\_VALUE to sort date field
> \*\*IMPORTANT\*\*: dont work sort only by ASC
> 
> !\[Image\](https://github.com/user-attachments/assets/73792a51-e4b0-4130-8ed7-3806ea42626b)
> 
> \### Steps to Reproduce
> 
> Set settings:
> \`\`\`
> PUT /\_cluster/settings 
> {
> "persistent" : {
> "search.default\_allow\_partial\_results" : false
> }
> }
> \`\`\`
> 
> Create index:
> \`\`\`
> PUT test8
> {
> "settings": {
> "number\_of\_shards": 10
> },
> "mappings": {
> "properties": {
> "reopen\_date" : {
> "type" : "date",
> "format": "yyyy-MM-dd HH:mm:ss"
> }
> }}
> }
> \`\`\`
> Add docs:
> \`\`\`
> POST \_bulk
> {"index":{"\_index":"test8"}}
> {"reopen\_date": null}
> {"index":{"\_index":"test8"}}
> {"reopen\_date": "2024-07-09 21:11:31"}
> {"index":{"\_index":"test8"}}
> {"reopen\_date": null}
> {"index":{"\_index":"test8"}}
> {"reopen\_date": null}
> {"index":{"\_index":"test8"}}
> {"reopen\_date": null}
> \`\`\`
> Execute:
> \`\`\`
> GET /test8/\_search?&from=0&size=1&sort=reopen\_date%3Aasc
> \`\`\`
> 
> See error:
> \`\`\`
> {
> "error": {
> "root\_cause": \[
> {
> "type": "arithmetic\_exception",
> "reason": "long overflow"
> }
> \],
> "type": "search\_phase\_execution\_exception",
> "reason": "Partial shards failure",
> "phase": "query",
> "grouped": true,
> "failed\_shards": \[
> {
> "shard": 3,
> "index": "test8",
> "node": "gnciuUg2SMSP756yJz6TGA",
> "reason": {
> "type": "arithmetic\_exception",
> "reason": "long overflow"
> }
> }
> \]
> },
> "status": 500
> }
> \`\`\`
> Sometimes need change \`size\` in query.
> Also its not reproduce when shards \< 3-5
> 
> \### Logs (if relevant)
> 
> \`\`\`
> {"type": "server", "timestamp": "2025-03-18T13:48:49,777Z", "level": "WARN", "component": "o.e.a.s.TransportSearchAction", "cluster.name": "prod-ue1-la-es-02", "node.name": "qla-prod-ue1-la-es-02-data-1.prod-ue1.live-agent.net", "message": "TransportSearchAction shard failure (partial results response)", "cluster.uuid": "zha7TU5yTgGZJ8kpiQemqg", "node.id": "tBs2yh-jSjyPb05WS4SURA" ,
> "stacktrace": \["org.elasticsearch.action.search.ShardSearchFailure: null",
> "at org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:534) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:458) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:337) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionListenerImplementations.safeAcceptException(ActionListenerImplementations.java:64) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionListenerImplementations.safeOnFailure(ActionListenerImplementations.java:75) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.DelegatingActionListener.onFailure(DelegatingActionListener.java:32) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:54) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:647) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.transport.TransportService$UnregisterChildTransportResponseHandler.handleException(TransportService.java:1786) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1510) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1644) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1619) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:44) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.support.ChannelActionListener.onFailure(ChannelActionListener.java:45) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionRunnable.onFailure(ActionRunnable.java:152) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:29) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:34) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1023) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27) ~\[elasticsearch-8.17.2.jar:?\]",
> "at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~\[?:?\]",
> "at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~\[?:?\]",
> "at java.lang.Thread.run(Thread.java:1575) ~\[?:?\]",
> "Caused by: java.lang.ArithmeticException: long overflow",
> "at java.lang.Math.addExact(Math.java:932) ~\[?:?\]",
> "at java.time.Instant.toEpochMilli(Instant.java:1287) ~\[?:?\]",
> "at org.elasticsearch.index.mapper.DateFieldMapper$Resolution$1.convert(DateFieldMapper.java:101) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.parseToLong(DateFieldMapper.java:696) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.isFieldWithinQuery(DateFieldMapper.java:778) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.isFieldWithinQuery(DateFieldMapper.java:742) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.sort.FieldSortBuilder.isBottomSortShardDisjoint(FieldSortBuilder.java:426) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.internal.ShardSearchRequest$RequestRewritable.rewrite(ShardSearchRequest.java:593) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.internal.ShardSearchRequest$RequestRewritable.rewrite(ShardSearchRequest.java:577) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.index.query.Rewriteable.rewrite(Rewriteable.java:57) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.SearchService.createSearchContext(SearchService.java:1173) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.SearchService.createContext(SearchService.java:1103) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:706) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:576) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:79) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:76) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.action.ActionRunnable$4.doRun(ActionRunnable.java:101) ~\[elasticsearch-8.17.2.jar:?\]",
> "at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27) ~\[elasticsearch-8.17.2.jar:?\]",
> "... 6 more"\] }
> \`\`\`

I'm going to comment there.
