Run a script Technical preview

GET /_scripts/painless/_execute

Runs a script and returns a result.

application/json

Body

  • context string

    The context that the script should run in.

  • Additional properties are allowed.

    Hide context_setup attributes Show context_setup attributes object
  • script object

    Additional properties are allowed.

    Hide script attributes Show script attributes object
    • source string

      The script source.

    • id string
    • params object

      Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

      Hide params attribute Show params attribute object
      • * object Additional properties

        Additional properties are allowed.

    • lang string

      Any of:

      Values are painless, expression, mustache, or java.

    • options object
      Hide options attribute Show options attribute object
      • * string Additional properties

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • result object Required

      Additional properties are allowed.

GET /_scripts/painless/_execute
curl \
 -X GET http://api.example.com/_scripts/painless/_execute \
 -H "Content-Type: application/json" \
 -d '{"context":"string","context_setup":{"document":{},"index":"string","query":{}},"script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}}}'