# Lucene expressions script - date comparison, boolean

**URL:** <https://discuss.elastic.co/t/lucene-expressions-script-date-comparison-boolean/72341>\
**Category:** Elasticsearch\
**Created:** [January 20, 2017, 9:12pm UTC](https://discuss.elastic.co/t/lucene-expressions-script-date-comparison-boolean/72341 "2017-01-20T21:12:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Johnson](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@Shawn\_Johnson](https://discuss.elastic.co/u/Shawn_Johnson)\
**Post date:** [January 20, 2017, 9:12pm UTC](https://discuss.elastic.co/t/lucene-expressions-script-date-comparison-boolean/72341/1 "2017-01-20T21:12:55Z")

</div>

I'm trying to use a lucene expressions for a scripted field to compare dates. It appears to be working, but the values are returned as 1/0 instead of true/false. Is this the expected behavior? Is there an alternative approach?

Note: I would be fine with 1/0, but I'm running into mapping issues using Spring Data Elasticsearch, it see's the script field value as a double type.

Example script:

```
"script_fields": {
    "isPast": {
       "script": {
          "inline": "doc['someDate'].value > now",
          "lang": "expression",
          "params": {
             "now": 1484860619114
          }
       }
    }
 },
```

---

<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:** [February 17, 2017, 9:13pm UTC](https://discuss.elastic.co/t/lucene-expressions-script-date-comparison-boolean/72341/2 "2017-02-17T21:13:03Z")

</div>

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