# 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:** 1\
**Showing post:** 2

<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"
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/validation-failed-1-id-is-too-long-must-be-no-longer-than-512-bytes-but-was-548/363875)._
