# Using scripted field again

**URL:** <https://discuss.elastic.co/t/using-scripted-field-again/108582>\
**Category:** Elasticsearch\
**Created:** [November 21, 2017, 3:37pm UTC](https://discuss.elastic.co/t/using-scripted-field-again/108582 "2017-11-21T15:37:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OucemaBellagha](https://avatars.discourse-cdn.com/v4/letter/o/5fc32e/32.png) [@OucemaBellagha](https://discuss.elastic.co/u/OucemaBellagha)\
**Post date:** [November 21, 2017, 3:37pm UTC](https://discuss.elastic.co/t/using-scripted-field-again/108582/1 "2017-11-21T15:37:32Z")

</div>

Hi, I have a scripted field returning a number "x" based on some calculation using Painless language, now I want to use that same number "x" in a new scripted field running expression language:  
`(doc['something'].value / doc['x'].value) *100`

But it's throwing an exception:  
`"type":"parse_exception","reason":"Field [x] does not exist in mappings"}}`

Now the exception is obvious as the field "x" is a scripted field and not a doc field so is there any solution to reuse my "x" variable somehow using expression lang?

---

<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:** [December 19, 2017, 3:37pm UTC](https://discuss.elastic.co/t/using-scripted-field-again/108582/2 "2017-12-19T15:37:35Z")

</div>

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