Why _count and _stats Return Different Document Numbers in Elasticsearch—and How to Fix It
The article explains why Elasticsearch's _count and _stats APIs can return vastly different document totals, especially when nested fields are involved, and provides step‑by‑step analysis, code examples, and practical solutions such as index refresh and data‑model adjustments.
