# Script\_lang not supported \[groovy\] error for script\_fields

**URL:** https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940
**Category:** Elasticsearch
**Created:** [March 9, 2016, 7:41pm UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940 "2016-03-09T19:41:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![toofan](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@toofan](https://discuss.elastic.co/u/toofan)
#### Post date: [March 9, 2016, 7:41pm UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940/1 "2016-03-09T19:41:13Z")

</div>

I am running an elasticsearch instance (from elasticsearch master code) on localhost.

I ran this query -

```
{
       "query" : {
             "match_all": {}
        },
        "script_fields": {
           "test": {
              "script": "_source.<field>"
           }
        }
 }

```

and this is the error I got -

```
{
   "error": {
      "root_cause": [
         {
            "type": "illegal_argument_exception",
            "reason": "script_lang not supported [groovy]"
         }
      ],
      "type": "search_phase_execution_exception",
      "reason": "all shards failed",
      "phase": "query",
      "grouped": true,
      "failed_shards": [
         {
            "shard": 0,
            "index": "<index_name>",
            "node": "XF48sEINTJu_JmWBWzTEKw",
            "reason": {
               "type": "illegal_argument_exception",
               "reason": "script_lang not supported [groovy]"
            }
         }
      ],
      "caused_by": {
         "type": "illegal_argument_exception",
         "reason": "script_lang not supported [groovy]"
      }
   },
   "status": 400
}

```

The solutions on internet is suggesting to add groovy dependency but I think master code already declares it. (Since I added groovy 2.4.6 as a dependency which gave an error of version conflict as 2.4.4 is already declared)

---

<div class="post-metadata">

### Author: ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)
#### Post date: [March 10, 2016, 9:02am UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940/2 "2016-03-10T09:02:03Z")

</div>

If you want to enable inline groovy script you'll need to add this lines to your config/elasticsearch.yml file on every node:

```auto
script.inline: true

```

You can check this page for further information:  
[https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html](https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html)

---

<div class="post-metadata">

### Author: ![toofan](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@toofan](https://discuss.elastic.co/u/toofan)
#### Post date: [March 11, 2016, 6:52am UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940/3 "2016-03-11T06:52:05Z")

</div>

Thanks for the help!  
I have added these lines in distribution/src/main/resources/config/elasticsearch.yml

```
script.inline: true
script.indexed: true

```

elasticsearch is still giving the same error.

---

<div class="post-metadata">

### Author: ![toofan](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@toofan](https://discuss.elastic.co/u/toofan)
#### Post date: [March 16, 2016, 4:28am UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940/4 "2016-03-16T04:28:30Z")

</div>

Where do we have to place the .groovy scripts ?

core/src/main/resources/config/scripts  
Is this path correct?

---

<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 5, 2017, 11:08pm UTC](https://discuss.elastic.co/t/script-lang-not-supported-groovy-error-for-script-fields/43940/5 "2017-07-05T23:08:02Z")

</div>


