# Can't do date range query in a small range

**URL:** <https://discuss.elastic.co/t/cant-do-date-range-query-in-a-small-range/56859>\
**Category:** Elasticsearch\
**Created:** [August 1, 2016, 6:58am UTC](https://discuss.elastic.co/t/cant-do-date-range-query-in-a-small-range/56859 "2016-08-01T06:58:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeywen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joeywen/32/22455_2.png) [@joeywen](https://discuss.elastic.co/u/joeywen)\
**Post date:** [August 1, 2016, 6:58am UTC](https://discuss.elastic.co/t/cant-do-date-range-query-in-a-small-range/56859/1 "2016-08-01T06:58:37Z")

</div>

my index mapping:

```json
{
  "order": 0,
  "template": "test_index*",
  "settings": {
    "index": {
      "refresh_interval": "1s"
    }
  },
  "mappings": {
    "logs": {
      "properties": {
        "sell_date_start": {
          "format": "yyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
          "type": "date"
        }
      },
      "_all": {
        "enabled": false
      }
    }
  },
  "aliases": {}
}

```

and my test data:

```json
{"sell_date_start":"2016-07-16 10:00:00", "@timestamp":"2016-07-21T06:18:38.659Z"}
{"sell_date_start":"2016-07-17 20:00:00", "@timestamp":"2016-07-21T06:18:50.659Z"}
{"sell_date_start":"2016-07-17 10:00:00", "@timestamp":"2016-07-21T06:18:00.659Z"}
{"sell_date_start":"2016-07-16 15:00:00", "@timestamp":"2016-07-21T06:18:18.659Z"}
{"sell_date_start":"2016-07-16 20:00:00", "@timestamp":"2016-07-21T06:18:28.659Z"}
{"sell_date_start":"2016-07-16 11:00:00", "@timestamp":"2016-07-21T06:19:38.659Z"}

```

the following query doesn't get any result:

```json
{
  "query": {
    "query_string": {
      "query": "sell_date_start:[1468634400000 TO 1468641600000]"
    }
  }
}
or
{
  "query": {
    "query_string": {
      "query": "sell_date_start:1468634400000"
    }
  }
}

```

But the following query can:

```json
{
  "query": {
    "query_string": {
      "query": "sell_date_start:[1468634400000 TO 1468670400000]"
    }
  }
}
or
{
  "query": {
    "query_string": {
      "query": "sell_date_start:[1468634400000 TO *]"
    }
  }
}

```

es version: 2.3.3

Why ?????  
Can anyone tell me why??

thanks

---

<div class="post-metadata">

**Author:** ![joeywen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joeywen/32/22455_2.png) [@joeywen](https://discuss.elastic.co/u/joeywen)\
**Post date:** [August 1, 2016, 7:01am UTC](https://discuss.elastic.co/t/cant-do-date-range-query-in-a-small-range/56859/2 "2016-08-01T07:01:34Z")

</div>

the doc [date format](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html) says "In JSON documents, dates are represented as strings. Elasticsearch uses a set of preconfigured formats to recognize and `parse these strings into a long value` representing milliseconds-since-the-epoch in UTC."

---

<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:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/cant-do-date-range-query-in-a-small-range/56859/3 "2017-07-05T22:31:21Z")

</div>


