Skip to content

Commit

Permalink
docs: Replaces indexed script java api docs with stored script api docs
Browse files Browse the repository at this point in the history
Closes #28144
  • Loading branch information
martijnvg committed Jan 10, 2018
1 parent 73f6857 commit 4182e9e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 38 deletions.
1 change: 1 addition & 0 deletions docs/java-api/admin/cluster/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ In the rest of this guide, we will use `client.admin().cluster()`.

include::health.asciidoc[]

include::stored-scripts.asciidoc[]
29 changes: 29 additions & 0 deletions docs/java-api/admin/cluster/stored-scripts.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[stored-scripts]]
==== Stored Scripts API

The stored script API allows one to interact with scripts and templates
stored in Elasticsearch. It can be used to create, update, get,
and delete stored scripts and templates.

[source,java]
--------------------------------------------------
PutStoredScriptResponse response = client.admin().cluster().preparePutStoredScript()
.setId("script1")
.setContent(new BytesArray("{\"script\": {\"lang\": \"painless\", \"source\": \"_score * doc['my_numeric_field'].value\"} }"), XContentType.JSON)
.get();
GetStoredScriptResponse response = client().admin().cluster().prepareGetStoredScript()
.setId("script1")
.get();
DeleteStoredScriptResponse response = client().admin().cluster().prepareDeleteStoredScript()
.setId("script1")
.get();
--------------------------------------------------

To store templates simply use "mustache" for the scriptLang.

===== Script Language

The put stored script API allows one to set the language of the stored script.
If one is not provided the default scripting language will be used.
2 changes: 0 additions & 2 deletions docs/java-api/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,4 @@ include::aggs.asciidoc[]

include::query-dsl.asciidoc[]

include::indexed-scripts.asciidoc[]

include::admin/index.asciidoc[]
36 changes: 0 additions & 36 deletions docs/java-api/indexed-scripts.asciidoc

This file was deleted.

0 comments on commit 4182e9e

Please sign in to comment.