The tune for search speed docs give the following advice regarding scripts:
Avoid scripts
In general, scripts should be avoided. If they are absolutely needed, you should prefer the painless and expressions engines.
While not inaccurate, this advice lacks nuance and doesn't explain the tradeoffs between index/search time. The painless and expressions engines references are also outdated.
Proposed solution
We could expand this section, adding an example similar to that added for EQL in #54346.