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

**URL:** <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>\
**Category:** Elasticsearch\
**Created:** [June 13, 2019, 1:19pm UTC](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 "2019-06-13T13:19:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![JinnaBalu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jinnabalu/32/27899_2.png) [@JinnaBalu](https://discuss.elastic.co/u/JinnaBalu)\
**Post date:** [June 18, 2019, 4:37am UTC](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 "2019-06-18T04:37:05Z")

</div>

I solved this issue with replacing the \_id value with new hash.

**Issue Logs :** Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 20456;2: id is too long, must be no longer than 512 bytes but was: 537;3: id is too long, must be no longer than 512 bytes but was: 10978;4: id is too long, must be no longer than 512 bytes but was: 544;

**Solution :**

- Run the following reindexing script for the indexes whose \_id is more than 512 bytes

1. Index _new\_student_

> curl -X DELETE "localhost:9200/new\_student?pretty=true"

> curl -X POST "localhost:9200/\_reindex?wait\_for\_completion=true&pretty=true" -H 'Content-Type: application/json' -d'  
> {  
> "source": {  
> "index": "student"  
> },  
> "dest": {  
> "index": "new\_student"  
> },  
> "script": {  
> "source": "if (ctx.\_id.length() \> 512) {ctx.\_id = 'null'}",  
> "lang": "painless"  
> }  
> }' \>\> student.txt

---

_[View the full topic](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)._
