Calling external APIs in sandboxed scripts

Hello

my apologies in advance if this seems trivial or deeply wrong. I tried to look for some documentation online, but didn't have any luck.

I was wondering if there was any way to call an external REST API when doing a scripted update.

Basically, I would like to call a script update in an index, where the script would just instantiate a REST client, call an external API sending the document source, and index back the result.

Is that something possible, in any language supported by ES scripting environment? Or do I have to write a plugin to do so ?

Thanks in advance.