# Issue with document-level security expression and date range

**URL:** <https://discuss.elastic.co/t/issue-with-document-level-security-expression-and-date-range/264197>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [February 13, 2021, 12:57am UTC](https://discuss.elastic.co/t/issue-with-document-level-security-expression-and-date-range/264197 "2021-02-13T00:57:00Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [February 13, 2021, 10:37pm UTC](https://discuss.elastic.co/t/issue-with-document-level-security-expression-and-date-range/264197/4 "2021-02-13T22:37:48Z")

</div>

> [@Range query in doc lvl security](https://discuss.elastic.co/t/range-query-in-doc-lvl-security/254431/2):
>
> There's no great solution. Typically we would recommend that you control that via indices. Have a daily index (or the minimum granularity you really need) and either: move them in/out of an alias each day (potentially you could use ILM to do something here) rewrite the role every day to change which indices it has access to It's also possible to do something with a custom roles provider (in Java), though there are some caching issues to deal with. Use an index per day as above, but have ro…

---

_[View the full topic](https://discuss.elastic.co/t/issue-with-document-level-security-expression-and-date-range/264197)._
