How does script caching work when the script is updated?

Does Elasticsearch recognise that a previously cached script has been updated, and replace the cache entry with the new script compilation?

I've seen code that manages script caching client-side, explicitly uploading new copies of a script when it changes. I've been looking at and I'm not sure whether this explicit behaviour is necessary - and if it is, why it isn't just handled by Elasticsearch itself.

Should I manage script updates with explicit code? Or is it handled better by Elasticsearch?

This is taken care of. The internal cache will create a new cache key when the script is updated and use that one (allowing the old entry to expire over time or due to the cache being bounded by size and its LRU policy).

1 Like

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