Briefly, this error occurs when there is a discrepancy in the number of documents between the primary shard and its replica in Elasticsearch. This could be due to a failed indexing operation or a network issue. To resolve this, you can try re-indexing the data, or manually force a shard reallocation. If the issue persists, consider checking the cluster’s health and the node logs for any underlying issues. Also, ensure that the network connectivity between the nodes is stable.
This guide will help you check for common problems that cause the log ” {} can’t to issue sync id [{}] for out of sync replica [{}] with num docs [{}]; num docs on primary [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: flush, indices.
Log Context
Log “{} can’t to issue sync id [{}] for out of sync replica [{}] with num docs [{}]; num docs on primary [{}]” classname is SyncedFlushService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
continue; } if (preSyncedResponse.numDocs != numDocsOnPrimary && preSyncedResponse.numDocs != PreSyncedFlushResponse.UNKNOWN_NUM_DOCS && numDocsOnPrimary != PreSyncedFlushResponse.UNKNOWN_NUM_DOCS) { logger.warn("{} can't to issue sync id [{}] for out of sync replica [{}] with num docs [{}]; num docs on primary [{}]"; shardId; syncId; shard; preSyncedResponse.numDocs; numDocsOnPrimary); results.put(shard; new ShardSyncedFlushResponse("out of sync replica; " + "num docs on replica [" + preSyncedResponse.numDocs + "]; num docs on primary [" + numDocsOnPrimary + "]")); countDownAndSendResponseIfDone(syncId; shards; shardId; totalShards; listener; countDown; results); continue;