# Script in Create Scripted Field form

**URL:** https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974
**Category:** Kibana
**Created:** [September 7, 2016, 11:15am UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974 "2016-09-07T11:15:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)
#### Post date: [September 7, 2016, 11:15am UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/1 "2016-09-07T11:15:30Z")

</div>

Is it possible to use anything but Lucene expressions in the "Create Scripted Field" form (in the "Script" input)? I use Groovy scripts in "Advanced"-\>"JSON Input" but I was wondering if it is possible to specify the script in the scripted field "definition".

![](https://us1.discourse-cdn.com/elastic/original/2X/d/dfe3d74431d14764710759b5ef80fa524e0587b3.png)

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [September 7, 2016, 7:00pm UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/2 "2016-09-07T19:00:36Z")

</div>

Hi Ilia, I'm not very familiar with scripted fields, but I found a previous thread which looks like it may be useful to you.

In this thread, the user was able to enable groovy scripts on Elasticsearch, create a scripted field, and then manually override the scripted field inside of the visualization by editing the aggregation bucket under the "Advanced" toggle: [Kibana Groovy Scripted Field for Aggregation: Visualize: Unsupported script value](https://discuss.elastic.co/t/kibana-groovy-scripted-field-for-aggregation-visualize-unsupported-script-value/54126)

Hope this helps,  
CJ

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [September 7, 2016, 7:01pm UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/3 "2016-09-07T19:01:55Z")

</div>

Here's another thread which seems to indicate a different way of enabling groovy scripts on Elasticsearch. If the first thread doesn't help you, this one might: [Script\_lang not supported [groovy] error for script\_fields](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940)

---

<div class="post-metadata">

### Author: ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)
#### Post date: [September 8, 2016, 8:36am UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/4 "2016-09-08T08:36:25Z")

</div>

Thanks a lot @cjcenizal!

In was already familiar with that [thread](https://discuss.elastic.co/t/kibana-groovy-scripted-field-for-aggregation-visualize-unsupported-script-value/54126). After going over it again I found what I was looking for.

The script needs to go to the "Create Scripted Field" form, to the "Script" input

 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/6b35297b786810940c047087bcbf73cc5dba8f9d.png)

Then, in the Visualization, in the Advanced-\>Json Input one needs to specify **{"script": {"lang":"groovy"}}**.  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/7/733a55c9b1e6d34b73fa5d026142ee52bf6aae8e.png)

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [September 8, 2016, 4:02pm UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/5 "2016-09-08T16:02:57Z")

</div>

Awesome! I'm glad you found your answer! Thanks a lot for posting it here, too. I'm sure someone else will come along with the same question and this will really help them out.

CJ

---

<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: [July 6, 2017, 1:39pm UTC](https://discuss.elastic.co/t/script-in-create-scripted-field-form/59974/6 "2017-07-06T13:39:20Z")

</div>


