Search code examples
elasticsearchelasticsearch-painless

Elasticsearch - Install stored scripts into filesystems


I hace a EL 7.6.1 cluster with 4 nodes.

I want install some stored scripts. Into documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html and) I only read about send a POST with somethint like this...

POST _scripts/calculate-score
{
  "script": {
    "lang": "painless",
    "source": "Math.log(_score * 2) + params.my_modifier"
  }
}

But I want install those scripts droping them into the filesystem.

I read this too but doesn't work.

If I copy those script into scripts folder, nothing happeds (neither in logs or GET _cluster/state/metadata?pretty&filter_path=**.stored_scripts).

My scripts looks like this... build_user_sessions_init_script.painless

These permisions

root@thorin:/# ls -la scripts/build_user_sessions_init_script.painless
-rw-r--r-- 1 elasticsearch elasticsearch 119 Mar 20 08:56 scripts/build_user_sessions_init_script.painless

With this code.

root@thorin:# cat build_user_sessions_init_script.painless 
state.all_queries = [];

There some place in doc to read about install stored scripts from filesystem?. Any idea?


Solution

  • File-based scripts have now been deprecated, and replaced by Stored scripts.

    The only clue has been... elastic/elasticsearch#24552 & elastic/elasticsearch#24555