Skip to content

Painless Endpoint to Execute Scripts #27875

@simianhacker

Description

@simianhacker

This is a feature request to add an endpoint for Painless to execute arbitrary scripts. I'm imaging something like the following:

POST /_painless/execute
{
  "script": {
      "source": "params.count / params.total"
      "params": {
          "count": 100
          "total": 1000
      }
  }

and the response would be something like

{
   "result": 0.1
}

Obviously this is a very simple example but with this type of interface we could replace the "math" (which uses Math.js) aggregation in TSVB with Painless and provide a way for the user to create scripts that allow them to manipulate data essentially the same way (but more secure). This would also provide a way to create interfaces for and testing and debugging painless scripts. I'm sure Rashid could use this as well in the new Canvas project to provide scripting as well.

@jdconrad @rashidkpc @epixa

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions