Adds get script language API (#1565)

* Adds get script language API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update get-script-language.md

* Incorporated editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
This commit is contained in:
kolchfa-aws 2022-10-18 17:25:00 -04:00 committed by GitHub
parent 8461daf22b
commit ca00b0b844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 101 additions and 2 deletions

View File

@ -3,7 +3,7 @@ layout: default
title: Get Stored Script Contexts
parent: Script APIs
grand_parent: REST API reference
nav_order: 4
nav_order: 5
---
## Get stored script contexts
@ -547,7 +547,7 @@ The `GET _script_context` request returns the following fields:
### Response fields
The `GET _scripts/my-first-script` request returns the following response fields:
The `GET _script_context` request returns the following response fields:
| Field | Data Type | Description |
:--- | :--- | :---

View File

@ -0,0 +1,99 @@
---
layout: default
title: Get Script Language
parent: Script APIs
grand_parent: REST API reference
nav_order: 6
---
## Get script language
The get script language API operation retrieves all supported script languages and their contexts.
#### Sample request
```json
GET _script_language
```
#### Sample response
The `GET _script_language` request returns the available contexts for each language:
```json
{
"types_allowed" : [
"inline",
"stored"
],
"language_contexts" : [
{
"language" : "expression",
"contexts" : [
"aggregation_selector",
"aggs",
"bucket_aggregation",
"field",
"filter",
"number_sort",
"score",
"terms_set"
]
},
{
"language" : "mustache",
"contexts" : [
"template"
]
},
{
"language" : "opensearch_query_expression",
"contexts" : [
"aggs",
"filter"
]
},
{
"language" : "painless",
"contexts" : [
"aggregation_selector",
"aggs",
"aggs_combine",
"aggs_init",
"aggs_map",
"aggs_reduce",
"analysis",
"bucket_aggregation",
"field",
"filter",
"ingest",
"interval",
"moving-function",
"number_sort",
"painless_test",
"processor_conditional",
"score",
"script_heuristic",
"similarity",
"similarity_weight",
"string_sort",
"template",
"terms_set",
"trigger",
"update"
]
}
]
}
```
### Response fields
The request contains the following response fields.
Field | Data Type | Description |
:--- | :--- | :---
types_allowed | List of strings | The types of scripts that are enabled, determined by the `script.allowed_types` setting. May contain `inline` and/or `stored`.
language_contexts | List of objects | A list of objects, each of which maps a supported language to its available contexts.
language_contexts.language | String | The name of the registered scripting language.
language_contexts.contexts | List of strings | A list of all contexts for the language, determined by the `script.allowed_contexts` setting.