# Count query over the date range doesn't return proper results

**URL:** <https://discuss.elastic.co/t/count-query-over-the-date-range-doesnt-return-proper-results/302476>\
**Category:** Elasticsearch\
**Created:** [April 15, 2022, 2:23am UTC](https://discuss.elastic.co/t/count-query-over-the-date-range-doesnt-return-proper-results/302476 "2022-04-15T02:23:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [April 15, 2022, 2:23am UTC](https://discuss.elastic.co/t/count-query-over-the-date-range-doesnt-return-proper-results/302476/1 "2022-04-15T02:23:57Z")

</div>

Executing following query

```auto
curl -s -XGET http://blah:9200/kgacrm-2022.04.15/_count?pretty=true {"query": {"range" : {"timestamp": { "gte" : "now-15m", "lt" : "now"}}}}
{
  "count" : 1725,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  }
}

```

It's returning me count for all the documents in the index. But when I look at the last 15 minutes through Kibana it's returning me 4 records. What's the issue with my query?

---

<div class="post-metadata">

**Author:** ![anime\_lover](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anime_lover/32/100265_2.png) [@anime\_lover](https://discuss.elastic.co/u/anime_lover)\
**Post date:** [April 15, 2022, 4:51am UTC](https://discuss.elastic.co/t/count-query-over-the-date-range-doesnt-return-proper-results/302476/2 "2022-04-15T04:51:56Z")

</div>

as per i see there is nothing wrong in your query

---

<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:** [May 13, 2022, 4:52am UTC](https://discuss.elastic.co/t/count-query-over-the-date-range-doesnt-return-proper-results/302476/3 "2022-05-13T04:52:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
