# Question in elastic search to get specific records with specific date and time range

**URL:** https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/262804
**Category:** Elasticsearch
**Created:** [February 1, 2021, 8:58am UTC](https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/262804 "2021-02-01T08:58:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kin\_Wan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kin_wan/32/81226_2.png) [@Kin\_Wan](https://discuss.elastic.co/u/Kin_Wan)
#### Post date: [February 1, 2021, 8:58am UTC](https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/262804/1 "2021-02-01T08:58:08Z")

</div>

I would like to grep all the records that match "successLoginID" between 2021-01-07 to 2021-01-13 with time range from 09:00 to 18:00 but no records found with the below code. Can advise what's the problem? Thanks.

```auto
GET /project.sli-app01.*/_search
{
  "query": {
    "bool": {
      "must": {
        "match": {
          "message": "successLoginID"
        }
      },
      "filter": {
        "bool": {
          "must": [
             {
              "range": {
                "@timestamp": {
                  "format": "YYYY-MM-DD",
                  "time_zone": "+08:00",
                  "gte":"2021-01-07",
                  "lt": "2021-01-13"
                }
              }},{
              "range": {
                "@timestamp": {
                  "format": "HH:mm",
                  "time_zone": "+08:00",
                  "gte":"09:00",
                  "lt": "18:00"
                }
              }
              }
          ]
        }
      }
    }
  },
  "size": 1000,
  "_source": [
    "@timestamp",
    "level",
    "message",
    "kubernetes.container_name"
  ]
}

```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [February 1, 2021, 11:11pm UTC](https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/262804/2 "2021-02-01T23:11:39Z")

</div>

It's better if you can keep your question to a single topic 🙂

Let's continue the discussion here - [Question in elastic search to get specific records with specific date and time range - Elastic Stack / Elasticsearch - Discuss the Elastic Stack](https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/261217)

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [February 1, 2021, 11:11pm UTC](https://discuss.elastic.co/t/question-in-elastic-search-to-get-specific-records-with-specific-date-and-time-range/262804/3 "2021-02-01T23:11:43Z")

</div>


