HTTP request from Painless script?

Hey,

I'm currently looking for a way to do HTTP requests from a Painless script.
Is that possible? Because i have not seen any examples of it when searching for it.

Use case:
Basically what i'm trying to do is runtime fields where i want to generate image and link fields, and to get this data i need to do API calls. It's not something used in prod, just for internal use (for Quepid).

Here is an example of how i want to execute the script:

PUT my-index/_mapping
{
  "runtime": {
    "image": {
      "type": "keyword",
      "script": {
        "source":
        """
          // HTTP request should happen here and then emit the image URL
        """
      }
    },
    "link": {
      "type": "keyword",
      "script": {
        "source":
        """
          // HTTP request should happen here and then emit the link URL
        """
      }
    },
  }
}

Thanks in advance

No, that is not possible. Apart from it being a very bad idea as it would have a huge impact on performance, I believe the security manager would not allow it as it would be a security risk.

1 Like

Thanks for the response! I will go a head with a different approach in that case.

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