# Range query for date of “long” field type in kibana

**URL:** <https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929>\
**Category:** Kibana\
**Created:** [March 20, 2016, 11:35am UTC](https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929 "2016-03-20T11:35:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nagarajan\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nagarajan_s/32/56148_2.png) [@Nagarajan\_S](https://discuss.elastic.co/u/Nagarajan_S)\
**Post date:** [March 20, 2016, 11:35am UTC](https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929/1 "2016-03-20T11:35:23Z")

</div>

I have a field in ES type representing date with long type.

I am trying to filter data in kibana based on this field. For example, get me the documents created in last seven days. But not able to come up with the solution.

In Kibana Visualization page, right now i have created like,

(events.time:[1458325800000 TO \*]) AND (event.type:"login")

But I need something like this

(events.time:[now-7d TO \*]) AND (event.type:"login")

Is it possible to achieve this with 'long' field type?

---

<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:** [March 20, 2016, 9:39pm UTC](https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929/2 "2016-03-20T21:39:54Z")

</div>

> [@Nagarajan\_S](#):
>
> events.time:[1458325800000 TO \*]

I am not sure that is valid, does it work at all?

---

<div class="post-metadata">

**Author:** ![Nagarajan\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nagarajan_s/32/56148_2.png) [@Nagarajan\_S](https://discuss.elastic.co/u/Nagarajan_S)\
**Post date:** [March 21, 2016, 5:21am UTC](https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929/3 "2016-03-21T05:21:06Z")

</div>

For `long` field type, it is working for me.

---

<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 6, 2017, 1:58pm UTC](https://discuss.elastic.co/t/range-query-for-date-of-long-field-type-in-kibana/44929/4 "2017-07-06T13:58:29Z")

</div>


