# Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 548;

**URL:** https://discuss.elastic.co/t/validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-548/363875
**Category:** Elasticsearch
**Created:** [July 26, 2024, 3:46pm UTC](https://discuss.elastic.co/t/validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-548/363875 "2024-07-26T15:46:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sibasish.palo](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@sibasish.palo](https://discuss.elastic.co/u/sibasish.palo)
#### Post date: [July 26, 2024, 3:46pm UTC](https://discuss.elastic.co/t/validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-548/363875/1 "2024-07-26T15:46:14Z")

</div>

we are migrating from an old elasticsearch version to 8.12 and for some documents we are seeing validation error like `Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 548;`

i know its a check exists in the code it self [here](https://github.com/elastic/elasticsearch/blob/8.12/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java#L253)

any suggestions to handle this scenario if my requirement is to accommodate ids more than 512b byte

Any help will be really very helpful

---

<div class="post-metadata">

### Author: ![Musab\_Dogan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musab_dogan/32/70691_2.png) [@Musab\_Dogan](https://discuss.elastic.co/u/Musab_Dogan)
#### Post date: [July 28, 2024, 10:20pm UTC](https://discuss.elastic.co/t/validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-548/363875/2 "2024-07-28T22:20:46Z")

</div>

If you use reindex for migration you can check this solution: [Reindexing failed - Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 672; - #4 by JinnaBalu](https://discuss.elastic.co/t/reindexing-failed-validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-672/185650/4)

```auto
POST /_reindex?wait_for_completion=true&pretty=true
{
  "source": {
    "index": "student"
  },
  "dest": {
    "index": "new_student"
  },
  "script": {
    "source": "if (ctx._id.length() > 512) {ctx._id = null}",
    "lang": "painless"
  }
}

```
