# Cat indices docs.count is way above actual document count

**URL:** <https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934>\
**Category:** Elasticsearch\
**Created:** [April 11, 2017, 8:07am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934 "2017-04-11T08:07:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [April 11, 2017, 8:07am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/1 "2017-04-11T08:07:46Z")

</div>

Hello.

I would like to get help with number of documents.

I have a indice which contains about **30M** docs. cat indices shows as below.

```
curl -XGET 10.0.1.5:9200/_cat/indices/sonested?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open sonested 3ZkXcwtjSIOcdlZJWpKgcg 1 0 29421692 0 4.9gb 4.9gb

```

However, if I execute `match_all query` , hits.total only returns **11203027**.

```
cat query.json.2
{
 "size": 0,
 "query": {
    "match_all": {}
 }
}
curl -XGET 10.0.1.5:9200/sonested/_search?pretty -d @query.json.2
{
  "took" : 328,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 11203027,
    "max_score" : 0.0,
    "hits" : []
  }
}

```

counts api also returns 11M

```
curl -XGET '10.0.1.5:9200/sonested/_count?pretty'
{
  "count" : 11203027,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  }
}

```

Why is **hits.total** different from docs.count of cat api?

Version I am using is 5.3.0

`[2017-04-11T16:41:35,777][INFO][o.e.n.Node] [uniform-2] version[5.3.0], pid[17602], build[3adb13b/2017-03-23T03:31:50.652Z], OS[Linux/3.10.0-`

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 11, 2017, 8:36am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/2 "2017-04-11T08:36:19Z")

</div>

Hey,

is it possible that you are using nested documents? Those are counted as part of the `indices.count`as they are separate lucene documents.

--Alex

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [April 11, 2017, 8:44am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/3 "2017-04-11T08:44:47Z")

</div>

See also [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/cat-indices.html#cat-indices](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/cat-indices.html#cat-indices)

" We can tell quickly how many shards make up an index, **the number of docs at the Lucene level, including hidden docs (e.g., from nested types),** deleted docs, primary store size, and total store size (all shards including replicas). All these exposed metrics come directly from Lucene APIs."

---

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [April 11, 2017, 9:20am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/4 "2017-04-11T09:20:40Z")

</div>

@spinscale

Your right. I did not notice that . Thanks!

```
{
  "sonested": {
    "mappings": {
      "question": {
        "dynamic": "strict",
        "properties": {
          "answer_count": {
            "type": "integer"
          },
          "answers": {
            "type": "nested",
            "properties": {
              "date": {
                "type": "date"
              },
              "user": {
                "type": "keyword"
              }
            }
          },
```

---

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [April 11, 2017, 9:21am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/5 "2017-04-11T09:21:40Z")

</div>

@johtani

Thanks Ohtani-san! I missed that line...

---

<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:** [May 9, 2017, 9:35am UTC](https://discuss.elastic.co/t/cat-indices-docs-count-is-way-above-actual-document-count/81934/6 "2017-05-09T09:35:54Z")

</div>

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