Get a script or search template

  • GET /_scripts/{id}
Auth

Retrieves a stored script or search template.

Required authorization

Cluster privileges manage

Path parameters

id string required

The identifier for the stored script or search template.

Query parameters

master_timeout string · default: 30s

The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. It can also be set to -1 to indicate that the request should never timeout.

Response

application/json
_id string required
found boolean required
script object
lang union anyOf required

The language the script is written in. For serach templates, use mustache.

Supported values include:

  • painless: Painless scripting language, purpose-built for Elasticsearch.
  • expression: Lucene’s expressions language, compiles a JavaScript expression to bytecode.
  • mustache: Mustache templated, used for templates.
  • java: Expert Java API
Values: painless expression mustache java
options map string to string
source string required

The script source. For search templates, an object containing the search template.