-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script api documentation #1094
script api documentation #1094
Conversation
Signed-off-by: Steve Murphy <[email protected]>
Signed-off-by: Steve Murphy <[email protected]>
…mentation-website into Steve-O-Murphy-script-documentation
…us corrections Signed-off-by: ariamarble <[email protected]>
tech review has been completed. api endpoints and scripts verified working |
The script APIs allow you to work with stored scripts. Stored scripts are part of the cluster state and reduce compilation time and enhance search speed. The default scripting language is Painless. | ||
|
||
You perform the following operations on stored scripts: | ||
* [create]({{site.url}}{{site.baseurl}}/opensearch/rest-api/script-apis/../../../../create-stored-script/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete the ../../../..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a minor comment
Signed-off-by: ariamarble <[email protected]>
| Parameter | Data Type | Description | | ||
:--- | :--- | :--- | ||
| context | String | Context in which the script or search template is to run. To prevent errors, the API immediately compiles the script or template in this context. | | ||
| cluster_manager_timeout | Time | Amount of time to wait for a connection to the master node. Defaults to 30 seconds. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide what term to use to replace "master node" (in running text). Primary node? We use "primary" and secondary shard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, actually the new node name for previous "master" node is "cluster manager" node now.
see https://opensearch.org/docs/latest/opensearch/cluster/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah primary and secondary are best I think. I'll go ahead and update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
| Field | Data Type | Description | | ||
:--- | :--- | :--- | ||
| lang | String | Scripting language. Required. | | ||
| source | String or Object | Required. <br /> <br /> For scripts, a string with the contents of the script. <br /> <br /> For search templates, an object that defines the search template. Supports the same parameters as the [Search API]({{site.url}}{{site.baseurl}}/opensearch/rest-api/search)'s request body. request body. Search templates also support Mustache variables. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"request body" repeated in this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
#### Sample response | ||
|
||
The `PUT _scripts/my-first-script` request returns the following fields: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a single field or plural?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singular. corrected
| Parameter | Data Type | Description | | ||
:--- | :--- | :--- | ||
| cluster_manager_timeout | Time | Amount of time to wait for a connection to the master node. Optional, defaults to `30s`. | | ||
| timeout | Time | The period of time to wait for a response. If a response is not received before the timeout value, the requ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this last sentence clipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
| Parameter | Data Type | Description | | ||
:--- | :--- | :--- | ||
| cluster_manager_timeout | Time | Amount of time to wait for a connection to the master node. Optional, defaults to `30s`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"master node" issue again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating these all to "cluster manager"
Signed-off-by: ariamarble <[email protected]>
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0)
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0)
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0)
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0) Co-authored-by: Aria Marble <[email protected]>
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0) Co-authored-by: Aria Marble <[email protected]>
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0) Co-authored-by: Aria Marble <[email protected]>
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]> (cherry picked from commit 21386b0) Co-authored-by: Aria Marble <[email protected]>
* Add script documentation. Signed-off-by: Steve Murphy <[email protected]> * Use my own example script insteady of Elastic's. Signed-off-by: Steve Murphy <[email protected]> * edditing and format changes. verified API requests and scripts. various corrections Signed-off-by: ariamarble <[email protected]> * made a couple of suggested changes Signed-off-by: ariamarble <[email protected]> * made further corrections Signed-off-by: ariamarble <[email protected]> Signed-off-by: Steve Murphy <[email protected]> Signed-off-by: ariamarble <[email protected]> Co-authored-by: Steve Murphy <[email protected]>
Description
new pull request replacing #1016
Issues Resolved
Partially resolves #424
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.