# Elastic 5 upgrade, groovy scripts dont execute

**URL:** <https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510>\
**Category:** Elasticsearch\
**Created:** [November 9, 2016, 2:39pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510 "2016-11-09T14:39:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 2:39pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/1 "2016-11-09T14:39:04Z")

</div>

I had a working set with groovy scripts on my Elastic server. Upgraded and no errors when running all as usual. Now I notice scripts dont execute or do anything. I copy the script files and Elastic compiles them fine. Any help? I dont configure anything in config for scripts now.

Console

```auto
GET _scripts
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "No endpoint or operation is available at [_scripts]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "No endpoint or operation is available at [_scripts]"
  },
  "status": 400
}

```

Start msg

```auto
[2016-11-09T15:48:10,782][INFO][o.e.n.Node] [kraftwerk] initializing ...
[2016-11-09T15:48:11,735][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [aggs-matrix-stats]
[2016-11-09T15:48:11,736][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [ingest-common]
[2016-11-09T15:48:11,736][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [lang-expression]
[2016-11-09T15:48:11,736][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [lang-groovy]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [lang-mustache]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [lang-painless]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [percolator]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [reindex]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [transport-netty3]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] loaded module [transport-netty4]
[2016-11-09T15:48:11,737][INFO][o.e.p.PluginsService] [kraftwerk] no plugins loaded
[2016-11-09T15:48:11,872][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\addDateToList.groovy]
[2016-11-09T15:48:12,078][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\addNumber.groovy]
[2016-11-09T15:48:12,087][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\add_date_product_incoming_items.groovy]
[2016-11-09T15:48:12,097][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\add_date_product_incoming_supplierorders.groovy]
[2016-11-09T15:48:12,107][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\add_sales_count_product.groovy]
[2016-11-09T15:48:12,131][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\add_sales_count_product2.groovy]
[2016-11-09T15:48:12,156][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\incrementBalanceProduct.groovy]
[2016-11-09T15:48:12,164][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\increment_monitored_product.groovy]
[2016-11-09T15:48:12,173][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\increment_orders_user.groovy]
[2016-11-09T15:48:12,181][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\increment_returnedorders.groovy]
[2016-11-09T15:48:12,191][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\increment_stock_product.groovy]
[2016-11-09T15:48:12,198][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\increment_totalSold_product.groovy]
[2016-11-09T15:48:12,210][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\nestedNumber.groovy]
[2016-11-09T15:48:12,225][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\sortCountSellable.groovy]
[2016-11-09T15:48:12,237][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\sortIncomingDates.groovy]
[2016-11-09T15:48:12,257][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\sortThirtyDaysSalesCount.groovy]
[2016-11-09T15:48:12,270][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\upsert_item_into_product.groovy]
[2016-11-09T15:48:12,288][INFO][o.e.s.ScriptService] [kraftwerk] compiling script file [C:\Dev\elasticsearch-5.0.0\config\scripts\upsert_supplierorder_into_product.groovy]

```

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [November 9, 2016, 2:54pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/2 "2016-11-09T14:54:54Z")

</div>

> [@Justus](#):
>
> GET \_scripts

This is not a valid command. Try `GET _scripts/groovy/addDateToList` ?

> Now notice scripts dont execute-do anything.

Can you explain what the problem is? I'm not sure I understand.

---

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 2:56pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/3 "2016-11-09T14:56:40Z")

</div>

I tried that just now, got notFound

{  
"lang": "groovy",  
"\_id": "addDateToList",  
"found": false  
}

From GET /\_nodes  
Modules

"name": "lang-groovy",  
"version": "5.0.0",  
"description": "Groovy scripting integration for Elasticsearch",  
"classname": "org.elasticsearch.script.groovy.GroovyPlugin"

---

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 2:58pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/4 "2016-11-09T14:58:41Z")

</div>

Thank you for the reply. I also using NEST 5.0-rc for C# calling and trying to execute the scripts. Last version you got an error when the scripts failed. Now I think they just dont execute. Could be a nest error but likely something I missed in the configs.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [November 9, 2016, 3:29pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/5 "2016-11-09T15:29:13Z")

</div>

> I tried that just now, got notFound

sorry, I forgot that `GET _scripts/...` only applies to STORED scripts (which are scripts stored in the cluster state in contrast to file-based scripts), so the request is not supposed to work.

Regarding issue where script is not executed by requests, are there any exceptions happening? Have you had a look at the Elasticsearch logs? Can you provide a query example?

---

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 3:33pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/6 "2016-11-09T15:33:50Z")

</div>

Nothing, no errors on server or in client.

This happens in local\_deprecation.log  
[2016-11-09T16:25:54,933][WARN][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead

Scripts are tested with 2.4.1 and are both complex and not  
Example:  
ctx.\_source.Number += shift

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [November 9, 2016, 3:37pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/7 "2016-11-09T15:37:18Z")

</div>

what's the output then? How does it differ from the expected output? I don't understand what you mean by "scripts not being executed".

---

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 3:39pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/8 "2016-11-09T15:39:20Z")

</div>

Well there would presumably change in the field that I update with values. So no change happens when running the script with +1. This worked fine before. Trying painless as well with no succes.

Oh could be related. I will have to try build this.

> <https://github.com/elastic/elasticsearch-net/commit/02083c5b358920b81d5bdffa581738f4266ad5bf>

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [November 9, 2016, 3:52pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/9 "2016-11-09T15:52:55Z")

</div>

Can you provide a minimal example to reproduce?

I tried the following:

- created script with name `increment-me.groovy`:

```auto
ctx._source.bar += 1

```

- script gets automatically compiled at startup:

```auto
[2016-11-09T16:27:44,615][INFO][o.e.s.ScriptService] [GB3s55V] compiling script file [~/elasticsearch-5.0/config/scripts/increment-me.groovy]

```

- added a document:

```auto
curl -XPOST localhost:9200/test/doc/1 -d '
{
    "bar": 1
}'

```

- ran update script a few times with:

```auto
curl -XPOST localhost:9200/test/doc/1/_update -d '
{
    "script" : {
        "file": "increment-me",
        "lang": "groovy"
    }
}'

```

- document is properly updated.

---

<div class="post-metadata">

**Author:** ![Justus](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Justus](https://discuss.elastic.co/u/Justus)\
**Post date:** [November 9, 2016, 4:07pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/10 "2016-11-09T16:07:03Z")

</div>

Yes that just doesn't happen for me with NEST. Before I could get an error when the field was wrong in the script, now nothing making me believe scripts are just not run at all.

I tried your way from the console and it works fine! So something with Nest then. Thank you for all help! It is so good to know where to point the effort even if we didnt solve the issue fully.

---

<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 7, 2016, 4:07pm UTC](https://discuss.elastic.co/t/elastic-5-upgrade-groovy-scripts-dont-execute/65510/11 "2016-12-07T16:07:09Z")

</div>

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