# Gather Data from Yesterday Until Today

**URL:** <https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740>\
**Category:** Elasticsearch\
**Created:** [December 20, 2023, 4:27pm UTC](https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740 "2023-12-20T16:27:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hi\_xavier](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hi\_xavier](https://discuss.elastic.co/u/hi_xavier)\
**Post date:** [December 20, 2023, 4:27pm UTC](https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740/1 "2023-12-20T16:27:45Z")

</div>

Hello,

I'm currently using the elk api to gather data between yesterday and today (12/19 @ 00:00:000 -- 12/20@00:00:000)  
Would this be the equivalent of that using a range query?

```auto
"range": {
    "timestamp": {
        "gte": "now-1d/d",
        "lte": "now/d",
                   }
}

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 21, 2023, 1:36am UTC](https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740/2 "2023-12-21T01:36:48Z")

</div>

Hi @hi_xavier

Yes in general that is correct

You can try a quick search to validate...

Of course for Today... the last timestamp will be only up to the current time...

```auto
GET logs-*/_search
{
  "size": 0, 
  "query": {
    "range": {
      "@timestamp": {
        "gte": "now/d-1d/d",
        "lte": "now/d"
      }
    }
  },
  "aggs": {
    "max": {
      "max": {
        "field": "@timestamp"
      }
    },
    "min": {
      "min": {
        "field": "@timestamp"
      }
    }  
  }
}

```

---

<div class="post-metadata">

**Author:** ![hi\_xavier](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hi\_xavier](https://discuss.elastic.co/u/hi_xavier)\
**Post date:** [December 27, 2023, 4:19pm UTC](https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740/3 "2023-12-27T16:19:48Z")

</div>

Understood! Thanks @stephenb !

---

<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:** [January 24, 2024, 4:20pm UTC](https://discuss.elastic.co/t/gather-data-from-yesterday-until-today/349740/4 "2024-01-24T16:20:31Z")

</div>

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