Inline Script with Parameters and Stored Script performance


Is there any performance difference between the inline script with parameters and stored script? And also how is elasticsearch not compiling the script if I use the same inline script with parameters multiple times?


Whether a script is stored or inline does not change if the script needs to be recompiled. The same inline script with different parameters should be cached, just like a stored script would be. The cache key is always the content of the script itself. Params are not part of this because they are runtime input to the script and do not change the compilation.

There should not be any performance difference between the two. The reason for stored scripts is to simplify reusing the same script without needing to store it client side.

Thank You. That was helpful.

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