Skip to content
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

Merged
merged 6 commits into from
Sep 2, 2022
Merged

Conversation

ariamarble
Copy link
Contributor

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.

Steve Murphy and others added 4 commits August 29, 2022 08:42
@ariamarble ariamarble requested a review from a team as a code owner September 2, 2022 21:10
@ariamarble ariamarble self-assigned this Sep 2, 2022
@ariamarble ariamarble added backport 1.3 PR: Backport label for v1.3.x backport 2.0 PR: Backport label for v2.0.x v2.3.0 backport 2.1 PR: Backport label for 2.1 backport 2.2 PR: Backport label for 2.2 labels Sep 2, 2022
@ariamarble
Copy link
Contributor Author

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/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete the ../../../..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a 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

| 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. |
Copy link
Contributor

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.

Copy link
Contributor

@alicejw1 alicejw1 Sep 2, 2022

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/
Screen Shot 2022-09-02 at 2 54 09 PM

Copy link
Contributor Author

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

Copy link
Contributor

@alicejw1 alicejw1 left a 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. |
Copy link
Contributor

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?

Copy link
Contributor Author

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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`. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"master node" issue again.

Copy link
Contributor Author

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]>
@ariamarble ariamarble merged commit 21386b0 into main Sep 2, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 2, 2022
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 2, 2022
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 2, 2022
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 2, 2022
* 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)
Copy link
Contributor

@cwillum cwillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Naarcha-AWS pushed a commit that referenced this pull request Sep 6, 2022
* 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]>
Naarcha-AWS pushed a commit that referenced this pull request Sep 6, 2022
* 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]>
Naarcha-AWS pushed a commit that referenced this pull request Sep 6, 2022
* 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]>
ariamarble added a commit that referenced this pull request Sep 6, 2022
* 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]>
@Naarcha-AWS Naarcha-AWS deleted the Steve-O-Murphy-script-documentation branch September 14, 2022 17:50
Naarcha-AWS pushed a commit that referenced this pull request Oct 6, 2022
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.3 PR: Backport label for v1.3.x backport 2.0 PR: Backport label for v2.0.x backport 2.1 PR: Backport label for 2.1 backport 2.2 PR: Backport label for 2.2 v2.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOC] Add missing Core REST API endpoints
4 participants