# Script Field - version change

**URL:** <https://discuss.elastic.co/t/script-field-version-change/278098>\
**Category:** Elasticsearch\
**Created:** [July 7, 2021, 5:06pm UTC](https://discuss.elastic.co/t/script-field-version-change/278098 "2021-07-07T17:06:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![angelogabeira](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@angelogabeira](https://discuss.elastic.co/u/angelogabeira)\
**Post date:** [July 7, 2021, 5:06pm UTC](https://discuss.elastic.co/t/script-field-version-change/278098/1 "2021-07-07T17:06:25Z")

</div>

guys, I'm changing from version 6.5 to version 7.9 and I need to redo the fields scripts.  
They're not working the same way, I've done some research but I couldn't.  
this example is what i did in 6.5 and it's working, i would like your invaluable help to pass it to the default which would be 7.9.  
thank you very much for any help.

**def temdata = doc['fechamento'].empty;**  
**def calculo = (doc['fechamento'].date.millis - doc['abertura'].date.millis) ;**  
**if (temdata==false) { return calculo; } else { return 0; }**

---

<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 4, 2021, 5:06pm UTC](https://discuss.elastic.co/t/script-field-version-change/278098/2 "2021-08-04T17:06:42Z")

</div>

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