# Permission filtering using current time

**URL:** <https://discuss.elastic.co/t/permission-filtering-using-current-time/94495>\
**Category:** Elasticsearch\
**Created:** [July 25, 2017, 2:43pm UTC](https://discuss.elastic.co/t/permission-filtering-using-current-time/94495 "2017-07-25T14:43:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdpark](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jdpark](https://discuss.elastic.co/u/jdpark)\
**Post date:** [July 25, 2017, 2:43pm UTC](https://discuss.elastic.co/t/permission-filtering-using-current-time/94495/1 "2017-07-25T14:43:56Z")

</div>

Hello,

I'm trying to create a role using the following query:

```auto
"range": {
  "a_date_field": {
    "gte": "now-1M/d"
  }
}

```

The intent is to only allow access to last month's data. Elastic returns `permission filters are not allowed to use the current timestamp`. I just want to confirm that I can't use `now` in permission filtering. Is that right? Thank you.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 26, 2017, 12:27am UTC](https://discuss.elastic.co/t/permission-filtering-using-current-time/94495/2 "2017-07-26T00:27:52Z")

</div>

> [@jdpark](#):
>
> I just want to confirm that I can't use now in permission filtering. Is that right?

That is correct. It is not possible to use `now` within a _Document Level Security_ query.

The simplest solution that I can think of, is to have an external process that uses the API to update your role definition every day at midnight.

---

<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:** [August 23, 2017, 12:27am UTC](https://discuss.elastic.co/t/permission-filtering-using-current-time/94495/3 "2017-08-23T00:27:55Z")

</div>

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