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

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:

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

and my query is:

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

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

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:

{
  "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?

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

Thanks!

I can reproduce it with the latest version:

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:

I'm going to comment there.

1 Like