# Understanding difference between /\_cat/indices and /\_search match\_all

**URL:** <https://discuss.elastic.co/t/understanding-difference-between--cat-indices-and--search-match-all/25751>\
**Category:** Elasticsearch\
**Created:** [July 16, 2015, 9:01pm UTC](https://discuss.elastic.co/t/understanding-difference-between--cat-indices-and--search-match-all/25751 "2015-07-16T21:01:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdh2550](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@jdh2550](https://discuss.elastic.co/u/jdh2550)\
**Post date:** [July 16, 2015, 9:01pm UTC](https://discuss.elastic.co/t/understanding-difference-between--cat-indices-and--search-match-all/25751/1 "2015-07-16T21:01:07Z")

</div>

If I run:

```
GET /267/_search
{
    "size": 0,
    "query": {"match_all": {}}
}

```

I get:

```
   "hits": {
      "total": 21055,

```

But if I run

```
GET /_cat/indices/267?v

```

I get

```
health status index pri rep docs.count docs.deleted store.size pri.store.size 
yellow open 267 5 1 891816 139508 66.1mb 66.1mb 

```

The first one tells me that there are 21,055 documents in the index. The second one tells me there are 891,816 documents in the index.

Please can you help me understand the difference?

Ahh... I think the answer just dawned on me - I have nested objects - and I bet the \_cat version is counting those hidden documents. Is there a way to make \_cat only count the visible documents? Also, is the number of non-deleted documents = docs.count - docs.deleted?

Many Thanks.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 16, 2015, 9:37pm UTC](https://discuss.elastic.co/t/understanding-difference-between--cat-indices-and--search-match-all/25751/2 "2015-07-16T21:37:29Z")

</div>

Yep you are exactly right. The docs.count will include your child-nested documents. I don't think there is a way to change the \_cat API to report just the number of parent-nested documents because is a lower level count which is asking the underlying Lucene IndexReader for its `maxDoc`. Also you are right in thinking that number of non-deleted docs = docs.count - docs.deleted

---

<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:** [July 6, 2017, 12:00am UTC](https://discuss.elastic.co/t/understanding-difference-between--cat-indices-and--search-match-all/25751/3 "2017-07-06T00:00:54Z")

</div>


