# Marvel doc count higher than count api

**URL:** https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925
**Category:** Elasticsearch
**Created:** [November 18, 2015, 11:16am UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925 "2015-11-18T11:16:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Pat\_Humphreys](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@Pat\_Humphreys](https://discuss.elastic.co/u/Pat_Humphreys)
#### Post date: [November 18, 2015, 11:16am UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925/1 "2015-11-18T11:16:48Z")

</div>

I have an index that has C. 231M docs in it, based on the response of the \_count api this is around the number I expect.

When I look at the index in marvel it says I have 3.7B docs on the index X16 times more than I should have.

I can see the output from the \_stats api that the count is C3.7B also  
{"primaries":{"docs":{"count":3706439463,"deleted":454714116}

So what is the difference between these two counts as I have other index's where these numbers match?

I am also using type nested in the mapping for the doc, so not sure if that is storing it as multiple docs?

---

<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: [November 18, 2015, 11:40am UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925/2 "2015-11-18T11:40:55Z")

</div>

Yes, nested objects are stored as multiple documents in your index. The \_stats api returns the number of individual Lucene documents in the index which will include all the nested documents as well as the root documents. See this section of the Definitive Guide book for more information on how nested documents work: [https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html)

---

<div class="post-metadata">

### Author: ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)
#### Post date: [November 18, 2015, 11:49am UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925/3 "2015-11-18T11:49:17Z")

</div>

Also for future reference a similar discussion here: [Why does \_stats doc count differ from \_search/\_count doc count for an index?](https://discuss.elastic.co/t/why-does--stats-doc-count-differ-from--search--count-doc-count-for-an-index/21722)

---

<div class="post-metadata">

### Author: ![Pat\_Humphreys](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@Pat\_Humphreys](https://discuss.elastic.co/u/Pat_Humphreys)
#### Post date: [November 18, 2015, 2:06pm UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925/4 "2015-11-18T14:06:30Z")

</div>

Thanks for clarifying that. So is it more expensive to load/query the doc this way? i.e. should I strip out the nested objects? As I am getting OOM errors when doing bulk data loads, not sure if its related to this problem or not

---

<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 5, 2017, 11:37pm UTC](https://discuss.elastic.co/t/marvel-doc-count-higher-than-count-api/34925/5 "2017-07-05T23:37:37Z")

</div>


