# Try to recover \[test-20181128\]\[2\] from primary shard with sync id but number of docs differ: 59432 (10.1.1.189, primary) vs 60034(10.1.1.190)

**URL:** <https://discuss.elastic.co/t/try-to-recover-test-20181128-2-from-primary-shard-with-sync-id-but-number-of-docs-differ-59432-10-1-1-189-primary-vs-60034-10-1-1-190/158983>\
**Category:** Elasticsearch\
**Created:** [December 1, 2018, 12:06am UTC](https://discuss.elastic.co/t/try-to-recover-test-20181128-2-from-primary-shard-with-sync-id-but-number-of-docs-differ-59432-10-1-1-189-primary-vs-60034-10-1-1-190/158983 "2018-12-01T00:06:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiankunking](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jiankunking/32/39320_2.png) [@jiankunking](https://discuss.elastic.co/u/jiankunking)\
**Post date:** [December 1, 2018, 12:06am UTC](https://discuss.elastic.co/t/try-to-recover-test-20181128-2-from-primary-shard-with-sync-id-but-number-of-docs-differ-59432-10-1-1-189-primary-vs-60034-10-1-1-190/158983/1 "2018-12-01T00:06:11Z")

</div>

We use three ES data nodes with setting -Xmx30g -Xms30g. The three ES servers have 128G physical memory and 32 CPU cores.

the ES version is 5.4.1.

The following exception was found in the log today:  
Caused by: java.lang.IllegalStateException: try to recover [test-20181128][2] from primary shard with sync id but number of docs differ: 59432 (10.1.1.189, primary) vs 60034(10.1.1.190) at org.elasticsearch.indices.recovery.RecoverySourceHandler.phase1(RecoverySourceHandler.java:226) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.indices.recovery.RecoverySourceHandler.recoverToTarget(RecoverySourceHandler.java:138) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.indices.recovery.PeerRecoverySourceService.recover(PeerRecoverySourceService.java:132) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.indices.recovery.PeerRecoverySourceService.access$100(PeerRecoverySourceService.java:54) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.indices.recovery.PeerRecoverySourceService$StartRecoveryTransportRequestHandler.messageReceived(PeerRecoverySourceService.java:141) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.indices.recovery.PeerRecoverySourceService$StartRecoveryTransportRequestHandler.messageReceived(PeerRecoverySourceService.java:138) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.4.1.jar:5.4.1] at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1528) ~[elasticsearch-5.4.1.jar:5.4.1] ... 5 more

i do not understand why the number of documents to be shard is less than the number of copies?

---

<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:** [December 1, 2018, 7:49am UTC](https://discuss.elastic.co/t/try-to-recover-test-20181128-2-from-primary-shard-with-sync-id-but-number-of-docs-differ-59432-10-1-1-189-primary-vs-60034-10-1-1-190/158983/2 "2018-12-01T07:49:05Z")

</div>

These symptoms could be explained by any of these three issues, all fixed in 6.3.0. In the meantime you can recover this index by rebuilding its replicas: set `number_of_replicas` to `0`, wait for the replicas to be deleted, and then set it back to its current value to create them again.

> <https://github.com/elastic/elasticsearch/pull/28787>

  

> <https://github.com/elastic/elasticsearch/pull/28790>

  

> <https://github.com/elastic/elasticsearch/pull/29619>

---

<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:** [December 29, 2018, 8:00am UTC](https://discuss.elastic.co/t/try-to-recover-test-20181128-2-from-primary-shard-with-sync-id-but-number-of-docs-differ-59432-10-1-1-189-primary-vs-60034-10-1-1-190/158983/3 "2018-12-29T08:00:17Z")

</div>

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