# How to use one scripted field to inside another scripted field

**URL:** <https://discuss.elastic.co/t/how-to-use-one-scripted-field-to-inside-another-scripted-field/98776>\
**Category:** Kibana\
**Created:** [August 30, 2017, 2:52am UTC](https://discuss.elastic.co/t/how-to-use-one-scripted-field-to-inside-another-scripted-field/98776 "2017-08-30T02:52:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinay\_garg](https://avatars.discourse-cdn.com/v4/letter/v/8dc957/32.png) [@vinay\_garg](https://discuss.elastic.co/u/vinay_garg)\
**Post date:** [August 30, 2017, 2:52am UTC](https://discuss.elastic.co/t/how-to-use-one-scripted-field-to-inside-another-scripted-field/98776/1 "2017-08-30T02:52:13Z")

</div>

I have created two scripted field 'oldDate'  
oldDate = doc['Date'].value.

and 'newDate'  
newDate = doc['oldDate'].

How can i use oldDate scripted field in second scripted field?

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [August 30, 2017, 1:18pm UTC](https://discuss.elastic.co/t/how-to-use-one-scripted-field-to-inside-another-scripted-field/98776/2 "2017-08-30T13:18:41Z")

</div>

Hi @vinay_garg,

as far as I know the scripted fields only have access to the document and the document `_source`. That means that your seconds script would have to also access `doc['date'].value`.

---

<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:** [September 27, 2017, 1:19pm UTC](https://discuss.elastic.co/t/how-to-use-one-scripted-field-to-inside-another-scripted-field/98776/3 "2017-09-27T13:19:04Z")

</div>

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