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

[DOC] Get _scripts API does not work #9161

Open
2 of 4 tasks
prabhupant opened this issue Feb 6, 2025 · 1 comment
Open
2 of 4 tasks

[DOC] Get _scripts API does not work #9161

prabhupant opened this issue Feb 6, 2025 · 1 comment

Comments

@prabhupant
Copy link
Contributor

What do you want to do?

  • Request a change to existing documentation
  • Add new documentation
  • Report a technical problem with the documentation
  • Other

Tell us about your request. Provide a summary of the request.

If we look at the scripts API here https://opensearch.org/docs/latest/api-reference/script-apis/get-stored-script/, it says we can use GET _scripts/my-first-script to retrieve a script but this throws an error

{
  "error": {
    "root_cause": [
      {
        "type": "invalid_index_name_exception",
        "reason": "Invalid index name [_scripts], must not start with '_'.",
        "index": "_scripts",
        "index_uuid": "_na_"
      }
    ],
    "type": "invalid_index_name_exception",
    "reason": "Invalid index name [_scripts], must not start with '_'.",
    "index": "_scripts",
    "index_uuid": "_na_"
  },
  "status": 400
}

Instead, we have to use GET _cluster/state/metadata?filter_path=metadata.stored_scripts to get the script. The document should mention this

Version: List the OpenSearch version to which this issue applies, e.g. 2.14, 2.12--2.14, or all.

What other resources are available? Provide links to related issues, POCs, steps for testing, etc.

@Naarcha-AWS
Copy link
Collaborator

@prabhupant: I think the example assumes that a script named my-first-script exists within the cluster. I'll update the endpoint at the top to use a generic , which should be replaced with a script that exists in your cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants