Runs a stored script written in the Painless language.
OpenSearch provides several ways to run a script; the following sections show how to run a script by passing script information in the request body of a `GET <index>/_search` request.
### Request fields
| Field | Data Type | Description |
:--- | :--- | :---
| query | Object | A filter that specifies documents to process. |
| script_fields | Object | Fields to include in output. |
| script | Object | ID of the script that produces a value for a field. |
The following request runs the stored script that was created in [Create or update stored script]({{site.url}}{{site.baseurl}}/api-reference/script-apis/create-stored-script/). The script sums the ratings for each book and displays the sum in the `total_ratings` field in the output.
* The `total_ratings` field value is the result of the `my-first-script` execution. See [Create or update stored script]({{site.url}}{{site.baseurl}}/api-reference/script-apis/create-stored-script/).