Scripts not in config/scripts on all nodes-->NO Error?

Hi all,

I just realized that I forgot to copy some scripts to all nodes, but when running a query over all documents in the index (--> so all nodes get to work) no error is shown and it does not crash.

Thing is, that the docs are also a bit ambiguous:
https://www.elastic.co/guide/en/elasticsearch/reference/2.1/modules-scripting.html#modules-scripting
says in the box of dynamic scripting:
"You will still be able to use Groovy scripts stored in files in the config/scripts/ directory on every node."

This can also be interpreted that the scripts need to be save in any of the nodes to be usable, not on all.

I wonder what actually is happening, the scripts are to multiply _score with some function inside function_score, so I am curious to know whether it is rescoring all docs or not.

I also checked that when calling an unexisting script (on all nodes) instead it actually does crash...

So in resumee the post boils down to 2 question:
1)Do the scripts have to be on all nodes?
2) If yes, why did I not get any error?

The scripts should be on all nodes. Do you have a default configuration for your index (5 shards, 1 replica)? How many nodes? The script will be run on 1 shard each, so only 5 nodes. If you had say 10 nodes with that setup (1 shard on every node), there would be 5 nodes in your request the script would not be run on. But doing further requests could select different copies of the shards, thus why the scripts should be on all nodes.

1 Like

Thanks for the reply Ryan. The setup is:
"number_of_shards": 6,
"number_of_replicas": 1,

on 3 nodes (6 masters for being able to scale up).

Was going through the logs on the nodes now. It is complaining about script not being found, but does not crash. Any idea why?

Sorry, I don't follow what you mean by "6 masters"? By a node, I mean an instance of bin/elasticsearch running.

What do you mean "it does not crash"? This would fail the query (should get a 4xx error), but would not cause elasticsearch to shutdown.

Lol sorry I need the proper nomenclature :slight_smile: and also just write a bit more clearly.

Atm ES runs on 3 nodes (=3 instances of bin/elasticsearch running). The 6 refers to the shards, i.e. in the /config/elasticsearch.yml there is this this setting:
"number_of_shards": 6,
"number_of_replicas": 1,

With crashing I mean a 4xx reply which I never got, it just executed my query and returned scores (which I assumed to have been rescored in the scripts).

Hope this is clearer.

Thanks a lot!