mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
64 lines
1.2 KiB
Text
64 lines
1.2 KiB
Text
[[get-stored-script-api]]
|
|
=== Get stored script API
|
|
++++
|
|
<titleabbrev>Get stored script</titleabbrev>
|
|
++++
|
|
|
|
.New API reference
|
|
[sidebar]
|
|
--
|
|
For the most up-to-date API details, refer to {api-es}/group/endpoint-script[Script APIs].
|
|
--
|
|
|
|
Retrieves a <<script-stored-scripts,stored script>> or <<search-template,search
|
|
template>>.
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
PUT _scripts/my-stored-script
|
|
{
|
|
"script": {
|
|
"lang": "painless",
|
|
"source": "Math.log(_score * 2) + params['my_modifier']"
|
|
}
|
|
}
|
|
----
|
|
////
|
|
|
|
[source,console]
|
|
----
|
|
GET _scripts/my-stored-script
|
|
----
|
|
// TEST[continued]
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
DELETE _scripts/my-stored-script
|
|
----
|
|
// TEST[continued]
|
|
////
|
|
|
|
[[get-stored-script-api-request]]
|
|
==== {api-request-title}
|
|
|
|
`GET _scripts/<script-id>`
|
|
|
|
[[get-stored-script-api-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
* If the {es} {security-features} are enabled, you must have the `manage`
|
|
<<privileges-list-cluster,cluster privilege>> to use this API.
|
|
|
|
[[get-stored-script-api-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
`<script-id>`::
|
|
(Required, string)
|
|
Identifier for the stored script or search template.
|
|
|
|
[[get-stored-script-api-query-params]]
|
|
==== {api-query-parms-title}
|
|
|
|
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|