Elastic search document count
GET index/type/_count
will return the top-level document count.
docs.count
in _cat/indices
returns the count of all documents, including artificial documents that have been created for nested fields.
That's why you see a difference:
- The former count (i.e. 9998) will tell you how many Elasticsearch documents are in your index, i.e. how many you have indexed.
- The latter count (i.e. 79978) will tell you how many Lucene documents are in your index.
So if one ES document contain a nested field with 5 sub-elements, you'll see 1 ES document, but 6 Lucene documents. Judging by the counts, each of your ES document has between 7 and 8 nested elements within it.