Get a script or search template Generally available

GET /_scripts/{id}

Retrieves a stored script or search template.

highlight#highlightFromAnchor" href="#topic-required-authorization"> 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.

Responses

GET _scripts/my-search-template
resp = client.get_script(
    id="my-search-template",
)
const response = await client.getScript({
  id: "my-search-template",
});
response = client.get_script(
  id: "my-search-template"
)
$resp = $client->getScript([
    "id" => "my-search-template",
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_scripts/my-search-template"
client.getScript(g -> g
    .id("my-search-template")
);