# Two commands return different segments info of the same index

**URL:** <https://discuss.elastic.co/t/two-commands-return-different-segments-info-of-the-same-index/295151>\
**Category:** Elasticsearch\
**Created:** [January 23, 2022, 4:48pm UTC](https://discuss.elastic.co/t/two-commands-return-different-segments-info-of-the-same-index/295151 "2022-01-23T16:48:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chembohuang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chembohuang/32/95903_2.png) [@chembohuang](https://discuss.elastic.co/u/chembohuang)\
**Post date:** [January 23, 2022, 4:48pm UTC](https://discuss.elastic.co/t/two-commands-return-different-segments-info-of-the-same-index/295151/1 "2022-01-23T16:48:10Z")

</div>

ES 7.7.1, jdk 14.  
A cluster with 3 dedicated master nodes and 100+ data nodes.  
During the execution of the forcemerge, myindex/\_stats and \_cat/segments/myindex return different segments info.  
Here is the forcemerge cmd, the ysearch6\_5 is about 4GB with 1 primary shard and 0 replica before the cmd is executed.

```auto
POST ysearch6_5/_forcemerge?max_num_segments=1

```

Before the \_forcemerge is done, ysearch6\_5/\_stats and \_cat/segments/ysearch6\_5 return different numbers of the segment count.

 ![stats](https://us1.discourse-cdn.com/elastic/original/3X/1/0/10df0942ea735f563037ce2b03b7637460a1a1f0.png)  
 ![segments](https://us1.discourse-cdn.com/elastic/original/3X/8/0/80767443018b3dcb17769f13536ef744caf82359.jpeg)

As we can see above, stats returns 2 segments of the index while \_cat/segments shows about 15+ segments of the index.  
I believe the \_cat/segment cmd is much more precise. But why this happens? Is it as expected or just a bug?

And here is another question:  
What happens if I set replica to 6 during the execution of the forcemerge? What segment files will be sent to the replica nodes?

---

<div class="post-metadata">

**Author:** ![chembohuang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chembohuang/32/95903_2.png) [@chembohuang](https://discuss.elastic.co/u/chembohuang)\
**Post date:** [January 25, 2022, 7:46am UTC](https://discuss.elastic.co/t/two-commands-return-different-segments-info-of-the-same-index/295151/3 "2022-01-25T07:46:57Z")

</div>

\_stats shows the number of the searchable segments while \_cat/segments shows all.

---

<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:** [February 22, 2022, 7:47am UTC](https://discuss.elastic.co/t/two-commands-return-different-segments-info-of-the-same-index/295151/4 "2022-02-22T07:47:44Z")

</div>

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