# Document/Record count is not matching for leader and follower when CCR Plugin is enabled

**URL:** https://forum.opensearch.org/t/document-record-count-is-not-matching-for-leader-and-follower-when-ccr-plugin-is-enabled/11427
**Category:** Cross-Cluster Replication
**Created:** [November 7, 2022, 8:56am UTC](https://forum.opensearch.org/t/document-record-count-is-not-matching-for-leader-and-follower-when-ccr-plugin-is-enabled/11427 "2022-11-07T08:56:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sanjay](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@sanjay](https://forum.opensearch.org/u/sanjay)
#### Post date: [November 7, 2022, 8:56am UTC](https://forum.opensearch.org/t/document-record-count-is-not-matching-for-leader-and-follower-when-ccr-plugin-is-enabled/11427/1 "2022-11-07T08:56:44Z")

</div>

Hi Team,

1. I have established a Cross-Cluster Replication supported environment  
where i could find a mismatch in the document/record count in the indices  
in both follower and the leader clusters. In fact, The document/record  
count in the follower seems to be more sometimes when i try to hit the  
records from \_cat/indices. At the same time, When i try to leave the cluster  
for a long time, the data starts to match and settle.

But when i try to fetch the total hit counts via the below curl commands, Im  
able to see consistent values in both the leader and follower opensearch  
clusters. **All the commands were run within very short time intervals (within 2 or 3 seconds)**

```
[root@root leader]# curl http://${LEADER}/log-test-2022.11.07/_search?pretty| jq .hits.total.value
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
  100 23322 100 23322 0 0 63835 0 --:--:-- --:--:-- --:--:-- 63895
  6636

 [root@root follower]# curl http://${FOLLOWER}/log-test-2022.11.07/_search? 
 pretty | jq .hits.total.value
 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
  100 23322 100 23322 0 0 63835 0 --:--:-- --:--:-- --:--:-- 63895
  6636

```

**Is this expected? Does the data takes time to reflect in both the clusters  
when we try to use the \_cat/indices API?** This mismatch in data was also observed in a single opensearch cluster where the document/record count were totally different when i tried using \_cat/indices and \<index\_name\>/\_search?pretty APIs

1. Second Query: When CCR is configured is it mandatory to provide all the nodes of Leader (including cluster\_manager, data, ingest nodes) as the seed hosts in the follower settings or just the master node is enough for the replication. Can this be a service name whose endpoints contain the list of Opensearch nodes of the leader cluster or should we mention individual nodes of the leader cluster for the follower to follow the leader.  
Also, Is it mandatory to configure the remote\_cluster\_client role in the node.roles for all the nodes of the follower (i.e in the ingest, cluster\_manager and data nodes)

TIA,  
Sanjay

---

<div class="post-metadata">

### Author: ![ankikala](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ankikala](https://forum.opensearch.org/u/ankikala)
#### Post date: [November 14, 2022, 4:58am UTC](https://forum.opensearch.org/t/document-record-count-is-not-matching-for-leader-and-follower-when-ccr-plugin-is-enabled/11427/2 "2022-11-14T04:58:05Z")

</div>

> [@sanjay](#):
>
> count

> The document/record  
> count in the follower seems to be more sometimes when i try to hit the  
> records from \_cat/indices

The doc count can be inaccurate sometimes as the new docs are available only after flush. So if follower index docs has been flushed but not leader’s , you might see more count on follower.

For verification, can you do a flush & search and the verify the doc count on both leader and follower?

---

<div class="post-metadata">

### Author: ![sanjay](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@sanjay](https://forum.opensearch.org/u/sanjay)
#### Post date: [November 18, 2022, 10:06am UTC](https://forum.opensearch.org/t/document-record-count-is-not-matching-for-leader-and-follower-when-ccr-plugin-is-enabled/11427/3 "2022-11-18T10:06:10Z")

</div>

Hi @ankikala, Any update on the second query in the above mentioned description?
