Skip to content

Commit 0b02413

Browse files
committed
docs: Replaces indexed script java api docs with stored script api docs
Closes #28144
1 parent 92b57e4 commit 0b02413

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

docs/java-api/admin/cluster/index.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ In the rest of this guide, we will use `client.admin().cluster()`.
1313

1414
include::health.asciidoc[]
1515

16+
include::stored-scripts.asciidoc[]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[[stored-scripts]]
2+
==== Stored Scripts API
3+
4+
The stored script API allows one to interact with scripts and templates
5+
stored in Elasticsearch. It can be used to create, update, get,
6+
and delete stored scripts and templates.
7+
8+
[source,java]
9+
--------------------------------------------------
10+
PutStoredScriptResponse response = client.admin().cluster().preparePutStoredScript()
11+
.setId("script1")
12+
.setContent(new BytesArray("{\"script\": {\"lang\": \"painless\", \"source\": \"_score * doc['my_numeric_field'].value\"} }"), XContentType.JSON)
13+
.get();
14+
15+
GetStoredScriptResponse response = client().admin().cluster().prepareGetStoredScript()
16+
.setId("script1")
17+
.get();
18+
19+
DeleteStoredScriptResponse response = client().admin().cluster().prepareDeleteStoredScript()
20+
.setId("script1")
21+
.get();
22+
--------------------------------------------------
23+
24+
To store templates simply use "mustache" for the scriptLang.
25+
26+
===== Script Language
27+
28+
The put stored script API allows one to set the language of the stored script.
29+
If one is not provided the default scripting language will be used.

docs/java-api/index.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,4 @@ include::aggs.asciidoc[]
216216

217217
include::query-dsl.asciidoc[]
218218

219-
include::indexed-scripts.asciidoc[]
220-
221219
include::admin/index.asciidoc[]

docs/java-api/indexed-scripts.asciidoc

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)