# Can you use date\_range fields in Painless scripts?

**URL:** <https://discuss.elastic.co/t/can-you-use-date-range-fields-in-painless-scripts/85063>\
**Category:** Elasticsearch\
**Created:** [May 9, 2017, 10:41am UTC](https://discuss.elastic.co/t/can-you-use-date-range-fields-in-painless-scripts/85063 "2017-05-09T10:41:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Napas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/napas/32/14423_2.png) [@Napas](https://discuss.elastic.co/u/Napas)\
**Post date:** [May 9, 2017, 10:41am UTC](https://discuss.elastic.co/t/can-you-use-date-range-fields-in-painless-scripts/85063/1 "2017-05-09T10:41:03Z")

</div>

Hi, I have a field called occupancy:

> ...  
> "occupancy": {  
> "type": "date\_range",  
> "format": "yyyy-MM-dd"  
> },  
> ...

I'm trying to use it in scripting, but failing with message: "Fielddata is not supported on field [occupancy] of type [date\_range]"

Is there a way to use (array of) date\_range fields in Painless scripts?

---

<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:** [June 6, 2017, 10:46am UTC](https://discuss.elastic.co/t/can-you-use-date-range-fields-in-painless-scripts/85063/2 "2017-06-06T10:46:07Z")

</div>

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