Elastic 5 upgrade, groovy scripts dont execute


(Justus Thorvaldsson) #1

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

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

[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]

(Yannick Welsch) #2

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.


(Justus Thorvaldsson) #3

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"


(Justus Thorvaldsson) #4

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.


(Yannick Welsch) #5

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?


(Justus Thorvaldsson) #6

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


(Yannick Welsch) #7

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".


(Justus Thorvaldsson) #8

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.


(Yannick Welsch) #9

Can you provide a minimal example to reproduce?

I tried the following:

  • created script with name increment-me.groovy:
ctx._source.bar += 1
  • script gets automatically compiled at startup:
[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:
curl -XPOST localhost:9200/test/doc/1 -d '
{
    "bar": 1
}'
  • ran update script a few times with:
curl -XPOST localhost:9200/test/doc/1/_update -d '
{
    "script" : {
        "file": "increment-me",
        "lang": "groovy"
    }
}'
  • document is properly updated.

(Justus Thorvaldsson) #10

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.


(system) #11

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