File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed
docs/reference/scripting/apis Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,19 @@ PUT _scripts/my-stored-script
13
13
{
14
14
"script": {
15
15
"lang": "painless",
16
- "source": """
17
- TimestampHour date = doc['@timestamp'].value;
18
- return date.getHour()
19
- """
16
+ "source": "Math.log(_score * 2) + params['my_modifier']"
20
17
}
21
18
}
22
19
----
23
20
21
+ ////
22
+ [source,console]
23
+ ----
24
+ DELETE _scripts/my-stored-script
25
+ ----
26
+ // TEST[continued]
27
+ ////
28
+
24
29
[[create-stored-script-api-request]]
25
30
==== {api-request-title}
26
31
Original file line number Diff line number Diff line change @@ -14,10 +14,7 @@ PUT _scripts/my-stored-script
14
14
{
15
15
"script": {
16
16
"lang": "painless",
17
- "source": """
18
- TimestampHour date = doc['@timestamp'].value;
19
- return date.getHour()
20
- """
17
+ "source": "Math.log(_score * 2) + params['my_modifier']"
21
18
}
22
19
}
23
20
----
Original file line number Diff line number Diff line change @@ -14,10 +14,7 @@ PUT _scripts/my-stored-script
14
14
{
15
15
"script": {
16
16
"lang": "painless",
17
- "source": """
18
- TimestampHour date = doc['@timestamp'].value;
19
- return date.getHour()
20
- """
17
+ "source": "Math.log(_score * 2) + params['my_modifier']"
21
18
}
22
19
}
23
20
----
@@ -29,6 +26,14 @@ GET _scripts/my-stored-script
29
26
----
30
27
// TEST[continued]
31
28
29
+ ////
30
+ [source,console]
31
+ ----
32
+ DELETE _scripts/my-stored-script
33
+ ----
34
+ // TEST[continued]
35
+ ////
36
+
32
37
[[get-stored-script-api-request]]
33
38
==== {api-request-title}
34
39
You can’t perform that action at this time.
0 commit comments