# How to see total number of real documents while using nested type

**URL:** https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916
**Category:** Elasticsearch
**Created:** [November 19, 2011, 6:12am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916 "2011-11-19T06:12:01Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [November 19, 2011, 6:12am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/1 "2011-11-19T06:12:01Z")

</div>

Hi ,

While using nested types , i have noticed that number of documents shown in  
head interface is not exactly the number of documents which are really  
indexed.  
Some of the documents are actually documents created out of nested types.

How can i see the real number of documents ?

Also what are the possible performance overheads of using nested types over  
array ?

Thanks  
Vineeth

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 19, 2011, 6:27am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/2 "2011-11-19T06:27:48Z")

</div>

As I understand it, document is persisted once with the nested docs and each nested doc is also persisted.

That's why the total number of documents seen by ES is growing faster than the number of documents you inject.

If you use the count API you should get back the number of documents you are looking for.

I suppose that there is performance overhead. I really prefer (if my use case allows it) to use arrays then nested docs.

HTH  
David 😉  
@dadoonet

Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a écrit :

> Hi ,
> 
> While using nested types , i have noticed that number of documents shown in head interface is not exactly the number of documents which are really indexed.  
> Some of the documents are actually documents created out of nested types.
> 
> How can i see the real number of documents ?
> 
> Also what are the possible performance overheads of using nested types over array ?
> 
> Thanks  
> Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [November 19, 2011, 6:34am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/3 "2011-11-19T06:34:01Z")

</div>

As i am having some complicated faceting needs , I have a situation where  
am forced to use nested type. ☹

I beleive the elasticSearch head uses count API to get number of documents.  
But that number is not what i wanted.  
Am still pondering on the question why coudlnt array have all these  
features nested type have !!!!

Thanks  
Vineeth

On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> As I understand it, document is persisted once with the nested docs and  
> each nested doc is also persisted.
> 
> That's why the total number of documents seen by ES is growing faster than  
> the number of documents you inject.
> 
> If you use the count API you should get back the number of documents you  
> are looking for.
> 
> I suppose that there is performance overhead. I really prefer (if my use  
> case allows it) to use arrays then nested docs.
> 
> HTH  
> David 😉  
> @dadoonet
> 
> Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> écrit :
> 
> > Hi ,
> > 
> > While using nested types , i have noticed that number of documents shown  
> > in head interface is not exactly the number of documents which are really  
> > indexed.  
> > Some of the documents are actually documents created out of nested types.
> > 
> > How can i see the real number of documents ?
> > 
> > Also what are the possible performance overheads of using nested types  
> > over array ?
> > 
> > Thanks  
> > Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [November 19, 2011, 6:54pm UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/4 "2011-11-19T18:54:12Z")

</div>

Hello Shay ,

Can you tell us what is the overhead of using nested type over arrays.  
Will it eat up more conputation time or memory ??

Tbanks  
Vineeth

On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan  
[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> As i am having some complicated faceting needs , I have a situation where  
> am forced to use nested type. ☹
> 
> I beleive the elasticSearch head uses count API to get number of documents.  
> But that number is not what i wanted.  
> Am still pondering on the question why coudlnt array have all these  
> features nested type have !!!!
> 
> Thanks  
> Vineeth
> 
> On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > As I understand it, document is persisted once with the nested docs and  
> > each nested doc is also persisted.
> > 
> > That's why the total number of documents seen by ES is growing faster  
> > than the number of documents you inject.
> > 
> > If you use the count API you should get back the number of documents you  
> > are looking for.
> > 
> > I suppose that there is performance overhead. I really prefer (if my use  
> > case allows it) to use arrays then nested docs.
> > 
> > HTH  
> > David 😉  
> > @dadoonet
> > 
> > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> > écrit :
> > 
> > > Hi ,
> > > 
> > > While using nested types , i have noticed that number of documents  
> > > shown in head interface is not exactly the number of documents which are  
> > > really indexed.  
> > > Some of the documents are actually documents created out of nested  
> > > types.
> > > 
> > > How can i see the real number of documents ?
> > > 
> > > Also what are the possible performance overheads of using nested types  
> > > over array ?
> > > 
> > > Thanks  
> > > Vineeth

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [November 20, 2011, 8:59am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/5 "2011-11-20T08:59:02Z")

</div>

Each nested element will end up being another document in the index. If you  
issue "count", they automatically get filtered out (as well as any other  
type of query that is not wrapped by nested one). The index stats API can  
return the actual number of docs in the index.

On Sat, Nov 19, 2011 at 8:54 PM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> Hello Shay ,
> 
> Can you tell us what is the overhead of using nested type over arrays.  
> Will it eat up more conputation time or memory ??
> 
> Tbanks  
> Vineeth
> 
> On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan \<[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)
> 
> > wrote:
> 
> > As i am having some complicated faceting needs , I have a situation  
> > where am forced to use nested type. ☹
> > 
> > I beleive the elasticSearch head uses count API to get number of  
> > documents.  
> > But that number is not what i wanted.  
> > Am still pondering on the question why coudlnt array have all these  
> > features nested type have !!!!
> > 
> > Thanks  
> > Vineeth
> > 
> > On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > As I understand it, document is persisted once with the nested docs and  
> > > each nested doc is also persisted.
> > > 
> > > That's why the total number of documents seen by ES is growing faster  
> > > than the number of documents you inject.
> > > 
> > > If you use the count API you should get back the number of documents you  
> > > are looking for.
> > > 
> > > I suppose that there is performance overhead. I really prefer (if my use  
> > > case allows it) to use arrays then nested docs.
> > > 
> > > HTH  
> > > David 😉  
> > > @dadoonet
> > > 
> > > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> > > écrit :
> > > 
> > > > Hi ,
> > > > 
> > > > While using nested types , i have noticed that number of documents  
> > > > shown in head interface is not exactly the number of documents which are  
> > > > really indexed.  
> > > > Some of the documents are actually documents created out of nested  
> > > > types.
> > > > 
> > > > How can i see the real number of documents ?
> > > > 
> > > > Also what are the possible performance overheads of using nested types  
> > > > over array ?
> > > > 
> > > > Thanks  
> > > > Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [November 20, 2011, 9:19am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/6 "2011-11-20T09:19:38Z")

</div>

Thanks Shay.

But then can you tell my why a seprate type called nested type was created  
!!! Instead cant all the things nested type can offer over arrays be  
implemented in array type itself

I am not criticizing anything but seeing this as a learning oppurtunaty , i  
would like to more about the same.

Thanks  
Vineeth

On Sun, Nov 20, 2011 at 2:29 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Each nested element will end up being another document in the index. If  
> you issue "count", they automatically get filtered out (as well as any  
> other type of query that is not wrapped by nested one). The index stats API  
> can return the actual number of docs in the index.
> 
> On Sat, Nov 19, 2011 at 8:54 PM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:
> 
> > Hello Shay ,
> > 
> > Can you tell us what is the overhead of using nested type over arrays.  
> > Will it eat up more conputation time or memory ??
> > 
> > Tbanks  
> > Vineeth
> > 
> > On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan \<  
> > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > 
> > > As i am having some complicated faceting needs , I have a situation  
> > > where am forced to use nested type. ☹
> > > 
> > > I beleive the elasticSearch head uses count API to get number of  
> > > documents.  
> > > But that number is not what i wanted.  
> > > Am still pondering on the question why coudlnt array have all these  
> > > features nested type have !!!!
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > As I understand it, document is persisted once with the nested docs and  
> > > > each nested doc is also persisted.
> > > > 
> > > > That's why the total number of documents seen by ES is growing faster  
> > > > than the number of documents you inject.
> > > > 
> > > > If you use the count API you should get back the number of documents  
> > > > you are looking for.
> > > > 
> > > > I suppose that there is performance overhead. I really prefer (if my  
> > > > use case allows it) to use arrays then nested docs.
> > > > 
> > > > HTH  
> > > > David 😉  
> > > > @dadoonet
> > > > 
> > > > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> > > > écrit :
> > > > 
> > > > > Hi ,
> > > > > 
> > > > > While using nested types , i have noticed that number of documents  
> > > > > shown in head interface is not exactly the number of documents which are  
> > > > > really indexed.  
> > > > > Some of the documents are actually documents created out of nested  
> > > > > types.
> > > > > 
> > > > > How can i see the real number of documents ?
> > > > > 
> > > > > Also what are the possible performance overheads of using nested  
> > > > > types over array ?
> > > > > 
> > > > > Thanks  
> > > > > Vineeth

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [November 20, 2011, 6:28pm UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/7 "2011-11-20T18:28:00Z")

</div>

What is your question? Did not manage to get it from your post...

On Sun, Nov 20, 2011 at 11:19 AM, Vineeth Mohan  
[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> Thanks Shay.
> 
> But then can you tell my why a seprate type called nested type was created  
> !!! Instead cant all the things nested type can offer over arrays be  
> implemented in array type itself
> 
> I am not criticizing anything but seeing this as a learning oppurtunaty ,  
> i would like to more about the same.
> 
> Thanks  
> Vineeth
> 
> On Sun, Nov 20, 2011 at 2:29 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Each nested element will end up being another document in the index. If  
> > you issue "count", they automatically get filtered out (as well as any  
> > other type of query that is not wrapped by nested one). The index stats API  
> > can return the actual number of docs in the index.
> > 
> > On Sat, Nov 19, 2011 at 8:54 PM, Vineeth Mohan \<[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)
> > 
> > > wrote:
> > 
> > > Hello Shay ,
> > > 
> > > Can you tell us what is the overhead of using nested type over arrays.  
> > > Will it eat up more conputation time or memory ??
> > > 
> > > Tbanks  
> > > Vineeth
> > > 
> > > On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan \<  
> > > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > > 
> > > > As i am having some complicated faceting needs , I have a situation  
> > > > where am forced to use nested type. ☹
> > > > 
> > > > I beleive the elasticSearch head uses count API to get number of  
> > > > documents.  
> > > > But that number is not what i wanted.  
> > > > Am still pondering on the question why coudlnt array have all these  
> > > > features nested type have !!!!
> > > > 
> > > > Thanks  
> > > > Vineeth
> > > > 
> > > > On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > > As I understand it, document is persisted once with the nested docs  
> > > > > and each nested doc is also persisted.
> > > > > 
> > > > > That's why the total number of documents seen by ES is growing faster  
> > > > > than the number of documents you inject.
> > > > > 
> > > > > If you use the count API you should get back the number of documents  
> > > > > you are looking for.
> > > > > 
> > > > > I suppose that there is performance overhead. I really prefer (if my  
> > > > > use case allows it) to use arrays then nested docs.
> > > > > 
> > > > > HTH  
> > > > > David 😉  
> > > > > @dadoonet
> > > > > 
> > > > > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> > > > > écrit :
> > > > > 
> > > > > > Hi ,
> > > > > > 
> > > > > > While using nested types , i have noticed that number of documents  
> > > > > > shown in head interface is not exactly the number of documents which are  
> > > > > > really indexed.  
> > > > > > Some of the documents are actually documents created out of nested  
> > > > > > types.
> > > > > > 
> > > > > > How can i see the real number of documents ?
> > > > > > 
> > > > > > Also what are the possible performance overheads of using nested  
> > > > > > types over array ?
> > > > > > 
> > > > > > Thanks  
> > > > > > Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [November 21, 2011, 4:25am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/8 "2011-11-21T04:25:58Z")

</div>

My question goes like this .

It seems to me that both nested types and arrays (with maps) performes the  
same function.  
But i didnt very much get the idea why we need nested types.  
Why cant we incoprate the functionalities of nested type to arrays and  
hence avoid overhead's due to nested types ?

Once again i am really greatfull that you are taking time to understand my  
question and answering it.

Thanks  
Vineeth

On Sun, Nov 20, 2011 at 11:58 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> What is your question? Did not manage to get it from your post...
> 
> On Sun, Nov 20, 2011 at 11:19 AM, Vineeth Mohan \<[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)
> 
> > wrote:
> 
> > Thanks Shay.
> > 
> > But then can you tell my why a seprate type called nested type was  
> > created !!! Instead cant all the things nested type can offer over arrays  
> > be  
> > implemented in array type itself
> > 
> > I am not criticizing anything but seeing this as a learning oppurtunaty ,  
> > i would like to more about the same.
> > 
> > Thanks  
> > Vineeth
> > 
> > On Sun, Nov 20, 2011 at 2:29 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Each nested element will end up being another document in the index. If  
> > > you issue "count", they automatically get filtered out (as well as any  
> > > other type of query that is not wrapped by nested one). The index stats API  
> > > can return the actual number of docs in the index.
> > > 
> > > On Sat, Nov 19, 2011 at 8:54 PM, Vineeth Mohan \<  
> > > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > > 
> > > > Hello Shay ,
> > > > 
> > > > Can you tell us what is the overhead of using nested type over arrays.  
> > > > Will it eat up more conputation time or memory ??
> > > > 
> > > > Tbanks  
> > > > Vineeth
> > > > 
> > > > On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan \<  
> > > > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > > > 
> > > > > As i am having some complicated faceting needs , I have a situation  
> > > > > where am forced to use nested type. ☹
> > > > > 
> > > > > I beleive the elasticSearch head uses count API to get number of  
> > > > > documents.  
> > > > > But that number is not what i wanted.  
> > > > > Am still pondering on the question why coudlnt array have all these  
> > > > > features nested type have !!!!
> > > > > 
> > > > > Thanks  
> > > > > Vineeth
> > > > > 
> > > > > On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr)wrote:
> > > > > 
> > > > > > As I understand it, document is persisted once with the nested docs  
> > > > > > and each nested doc is also persisted.
> > > > > > 
> > > > > > That's why the total number of documents seen by ES is growing faster  
> > > > > > than the number of documents you inject.
> > > > > > 
> > > > > > If you use the count API you should get back the number of documents  
> > > > > > you are looking for.
> > > > > > 
> > > > > > I suppose that there is performance overhead. I really prefer (if my  
> > > > > > use case allows it) to use arrays then nested docs.
> > > > > > 
> > > > > > HTH  
> > > > > > David 😉  
> > > > > > @dadoonet
> > > > > > 
> > > > > > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) a  
> > > > > > écrit :
> > > > > > 
> > > > > > > Hi ,
> > > > > > > 
> > > > > > > While using nested types , i have noticed that number of documents  
> > > > > > > shown in head interface is not exactly the number of documents which are  
> > > > > > > really indexed.  
> > > > > > > Some of the documents are actually documents created out of nested  
> > > > > > > types.
> > > > > > > 
> > > > > > > How can i see the real number of documents ?
> > > > > > > 
> > > > > > > Also what are the possible performance overheads of using nested  
> > > > > > > types over array ?
> > > > > > > 
> > > > > > > Thanks  
> > > > > > > Vineeth

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [November 21, 2011, 6:45pm UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/9 "2011-11-21T18:45:16Z")

</div>

When indexing arrays in docs without nested types, they end up indexed in  
the same doc (Lucene document). This means that any query on specific  
element within the array and relationship to another element in the array  
is problematic. Thats what nested types come to solve, at the price of  
indexing each element as a separate doc.

On Mon, Nov 21, 2011 at 6:25 AM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> My question goes like this .
> 
> It seems to me that both nested types and arrays (with maps) performes the  
> same function.  
> But i didnt very much get the idea why we need nested types.  
> Why cant we incoprate the functionalities of nested type to arrays and  
> hence avoid overhead's due to nested types ?
> 
> Once again i am really greatfull that you are taking time to understand my  
> question and answering it.
> 
> Thanks  
> Vineeth
> 
> On Sun, Nov 20, 2011 at 11:58 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > What is your question? Did not manage to get it from your post...
> > 
> > On Sun, Nov 20, 2011 at 11:19 AM, Vineeth Mohan \<  
> > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > 
> > > Thanks Shay.
> > > 
> > > But then can you tell my why a seprate type called nested type was  
> > > created !!! Instead cant all the things nested type can offer over arrays  
> > > be  
> > > implemented in array type itself
> > > 
> > > I am not criticizing anything but seeing this as a learning oppurtunaty  
> > > , i would like to more about the same.
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Sun, Nov 20, 2011 at 2:29 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > Each nested element will end up being another document in the index. If  
> > > > you issue "count", they automatically get filtered out (as well as any  
> > > > other type of query that is not wrapped by nested one). The index stats API  
> > > > can return the actual number of docs in the index.
> > > > 
> > > > On Sat, Nov 19, 2011 at 8:54 PM, Vineeth Mohan \<  
> > > > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > > > 
> > > > > Hello Shay ,
> > > > > 
> > > > > Can you tell us what is the overhead of using nested type over arrays.  
> > > > > Will it eat up more conputation time or memory ??
> > > > > 
> > > > > Tbanks  
> > > > > Vineeth
> > > > > 
> > > > > On Sat, Nov 19, 2011 at 12:04 PM, Vineeth Mohan \<  
> > > > > [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)\> wrote:
> > > > > 
> > > > > > As i am having some complicated faceting needs , I have a situation  
> > > > > > where am forced to use nested type. ☹
> > > > > > 
> > > > > > I beleive the elasticSearch head uses count API to get number of  
> > > > > > documents.  
> > > > > > But that number is not what i wanted.  
> > > > > > Am still pondering on the question why coudlnt array have all these  
> > > > > > features nested type have !!!!
> > > > > > 
> > > > > > Thanks  
> > > > > > Vineeth
> > > > > > 
> > > > > > On Sat, Nov 19, 2011 at 11:57 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr)wrote:
> > > > > > 
> > > > > > > As I understand it, document is persisted once with the nested docs  
> > > > > > > and each nested doc is also persisted.
> > > > > > > 
> > > > > > > That's why the total number of documents seen by ES is growing  
> > > > > > > faster than the number of documents you inject.
> > > > > > > 
> > > > > > > If you use the count API you should get back the number of documents  
> > > > > > > you are looking for.
> > > > > > > 
> > > > > > > I suppose that there is performance overhead. I really prefer (if my  
> > > > > > > use case allows it) to use arrays then nested docs.
> > > > > > > 
> > > > > > > HTH  
> > > > > > > David 😉  
> > > > > > > @dadoonet
> > > > > > > 
> > > > > > > Le 19 nov. 2011 à 07:12, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)  
> > > > > > > a écrit :
> > > > > > > 
> > > > > > > > Hi ,
> > > > > > > > 
> > > > > > > > While using nested types , i have noticed that number of documents  
> > > > > > > > shown in head interface is not exactly the number of documents which are  
> > > > > > > > really indexed.  
> > > > > > > > Some of the documents are actually documents created out of nested  
> > > > > > > > types.
> > > > > > > > 
> > > > > > > > How can i see the real number of documents ?
> > > > > > > > 
> > > > > > > > Also what are the possible performance overheads of using nested  
> > > > > > > > types over array ?
> > > > > > > > 
> > > > > > > > Thanks  
> > > > > > > > Vineeth

---

<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, 3:48am UTC](https://discuss.elastic.co/t/how-to-see-total-number-of-real-documents-while-using-nested-type/5916/10 "2017-07-06T03:48:01Z")

</div>


