I am trying to understand Index Stats API better here. I have two indices,
both with the same data. However, the mappings differ. One of them has some
fields that have type as nested. Now the number of documents shown in the
Index Stats API response for the one that has nested type fields is more
than the one that does not have nested type fields. Although when I do a
GET /INDEX_NAME/_search?search_type=count for both the indices, I get the
same count in the response.
Does this mean that Index Stats API is counting nested documents separately?
Yes, nested documents are separate lucene documents, that are never
returned (for now) by the ordinary elasticsearch search apis as they are
filtered out by default. Only a single document gets returned (and
counted), which contains both parent and nested docs. On the lucene index
you have though separate docs stored on the same block.
The _stats api reads the number of documents from lucene (including
nested), while the count and search apis execute a query and filter the
nested docs out.
Hope this clarifies things
On Friday, January 17, 2014 2:53:56 PM UTC+1, Vaidik Kapoor wrote:
Hi Guys,
I am trying to understand Index Stats API better here. I have two indices,
both with the same data. However, the mappings differ. One of them has some
fields that have type as nested. Now the number of documents shown in
the Index Stats API response for the one that has nested type fields is
more than the one that does not have nested type fields. Although when I do
a GET /INDEX_NAME/_search?search_type=count for both the indices, I get the
same count in the response.
Does this mean that Index Stats API is counting nested documents
separately?
Yes, nested documents are separate lucene documents, that are never
returned (for now) by the ordinary elasticsearch search apis as they are
filtered out by default. Only a single document gets returned (and
counted), which contains both parent and nested docs. On the lucene index
you have though separate docs stored on the same block.
The _stats api reads the number of documents from lucene (including
nested), while the count and search apis execute a query and filter the
nested docs out.
Hope this clarifies things
On Friday, January 17, 2014 2:53:56 PM UTC+1, Vaidik Kapoor wrote:
Hi Guys,
I am trying to understand Index Stats API better here. I have two
indices, both with the same data. However, the mappings differ. One of them
has some fields that have type as nested. Now the number of documents
shown in the Index Stats API response for the one that has nested type
fields is more than the one that does not have nested type fields. Although
when I do a GET /INDEX_NAME/_search?search_type=count for both the
indices, I get the same count in the response.
Does this mean that Index Stats API is counting nested documents
separately?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.