# When the number of documents exceeds 2 billion, the index status becomes RED

**URL:** <https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461>\
**Category:** Elasticsearch\
**Created:** [August 23, 2023, 10:22am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461 "2023-08-23T10:22:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![im.jinxinwang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/im.jinxinwang/32/124867_2.png) [@im.jinxinwang](https://discuss.elastic.co/u/im.jinxinwang)\
**Post date:** [August 23, 2023, 10:22am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/1 "2023-08-23T10:22:45Z")

</div>

Version: 7.8.1  
Cause of failure: The number of important index documents in the 7.8.1 open source version of ES has reached the limit of 2147483519 in Lucene. The index status is red, and read and write operations cannot be performed.  
Remark:

1. This important index file has only one primary shard and one copy shard, neither of which can be read and written, and the index size is more than 200 G.
2. Due to the rush to restore the business, directly back up the data files in the indices directory.

Hope idnex can return to normal state.

---

<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:** [August 23, 2023, 10:44am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/2 "2023-08-23T10:44:30Z")

</div>

The best practices recommends no more than 20/50gb per shard.  
I don't know if you can recover or if you have to reindex here to a better design. If you do, please follow the guidelines.

> **[Size your shards | Elasticsearch Guide \[8.9\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/size-your-shards.html)**

---

<div class="post-metadata">

**Author:** ![im.jinxinwang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/im.jinxinwang/32/124867_2.png) [@im.jinxinwang](https://discuss.elastic.co/u/im.jinxinwang)\
**Post date:** [August 23, 2023, 11:00am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/3 "2023-08-23T11:00:03Z")

</div>

Thank you very much for your answer. The accident was caused by the company's R&D staff not having a good grasp of es. Is there really no way for me to recover the original index data now?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [August 23, 2023, 11:02am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/4 "2023-08-23T11:02:48Z")

</div>

> [@im.jinxinwang](#):
>
> Version: 7.8.1

This version passed [EOL](https://www.elastic.co/support/eol) a very long time ago and is not supported any more. This bug was fixed by the following PR almost 3 years ago:

> <https://github.com/elastic/elasticsearch/pull/63273>
>
> Today indexing to a shard with 2147483519 documents will fail that shard. We sho…uld check the number of documents and reject the write requests instead.
> 
> Closes #51136

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [August 23, 2023, 11:11am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/5 "2023-08-23T11:11:58Z")

</div>

> [@im.jinxinwang](#):
>
> Is there really no way for me to recover the original index data now?

I'd recommend recovering from a recent snapshot. I don't know of another way.

---

<div class="post-metadata">

**Author:** ![im.jinxinwang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/im.jinxinwang/32/124867_2.png) [@im.jinxinwang](https://discuss.elastic.co/u/im.jinxinwang)\
**Post date:** [August 24, 2023, 3:24am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/6 "2023-08-24T03:24:29Z")

</div>

This is unfortunate news for me because the company had no previous backups of that index.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 21, 2023, 3:24am UTC](https://discuss.elastic.co/t/when-the-number-of-documents-exceeds-2-billion-the-index-status-becomes-red/341461/7 "2023-09-21T03:24:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
