Get a script or search template Generally available

GET /_scripts/{id}

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

    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.

    Values are -1 or 0.

    External documentation

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • _id string Required
    • found boolean Required
    • script object
      Hide script attributes Show script attributes object
      • lang string

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

        Any of:

        Values are painless, expression, mustache, or java.

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

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

        One of:
GET /_scripts/{id}
curl \
 --request GET 'http://api.example.com/_scripts/{id}'