# How to get the data from yesterday to today's date range

**URL:** <https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493>\
**Category:** Elasticsearch\
**Created:** [March 26, 2021, 12:46pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493 "2021-03-26T12:46:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![suresh123](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@suresh123](https://discuss.elastic.co/u/suresh123)\
**Post date:** [March 26, 2021, 12:46pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/1 "2021-03-26T12:46:00Z")

</div>

```auto
Hello Experts,

I have tried to get the data between dates as below, but the exact date it is not giving.It is under UTC format.
"range" : {
                "@timestamp" : {
                  "gte": "now-1d/d ",
                  "lt": "now/d"
                }
              }
            
Please help how to get the data for last 24 hours between dates.

Regards,
Suresh

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 26, 2021, 1:55pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/2 "2021-03-26T13:55:14Z")

</div>

Please just format the code part with the markdown code characters, not the whole text. Thanks.

Could you explain a bit more what you are looking for? I don't understand what the problem is with the current query.

---

<div class="post-metadata">

**Author:** ![suresh123](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@suresh123](https://discuss.elastic.co/u/suresh123)\
**Post date:** [March 26, 2021, 2:43pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/3 "2021-03-26T14:43:27Z")

</div>

```auto
Hi Dadoonet,

We have dev-applogs index in which we would like to get container_name and message field by filtering message : "exception".

**What we are expecting** 

It should come the data between yesterday midnight to now(specific time)
Example : 25-03-2021 midnight to 26-03-201 

But now I am not able to fetch the data between dates and time.

`curl -X GET "http://elasticsearchip:port/dev-applogs-*/_search?pretty" -H `'Content-Type: application/json' -d'
`{
  ` "_source": ["kubernetes.container.name", "kubernetes.namespace", `"message", "@timestamp"],
  ` "query": {
    ` "bool": {
      ` "must": [
        ` {
          ` "match": {"message": "exception"}
            `},
            `{
              `"range" : {
                `"@timestamp" : {
                  `"gte": "now-1d/d",
                  `"lt": "now/d"
                `}
              `}
            `}
           `]
          `}
         `}
`}
`'

What I need to give exactly to get the whole data from Yesterday to now.
"gte": "now-1d/d",
"lt": "now/d"

Regards,
Suresh

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 26, 2021, 3:11pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/4 "2021-03-26T15:11:12Z")

</div>

PLEASE.

> Please just format the code part with the markdown code characters, not the whole text. Thanks.

Could you edit your post please and make it more readable? Thanks!

---

<div class="post-metadata">

**Author:** ![suresh123](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@suresh123](https://discuss.elastic.co/u/suresh123)\
**Post date:** [March 26, 2021, 3:23pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/5 "2021-03-26T15:23:59Z")

</div>

Can you please look into above.

---

<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:** [April 23, 2021, 3:24pm UTC](https://discuss.elastic.co/t/how-to-get-the-data-from-yesterday-to-todays-date-range/268493/6 "2021-04-23T15:24:41Z")

</div>

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