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

[BUG] V2.5 OpenSearch Node.js client documentation for "Get Snapshot" describes parameters not supported by V2.12 OpenSearch API #728

Open
geraintwjones opened this issue Mar 5, 2024 · 5 comments

Comments

@geraintwjones
Copy link

geraintwjones commented Mar 5, 2024

What is the bug?

The version 2.5 OpenSearch Node.js client documentation for SnapshotApi#get(params, options, callback) in the API-Snapshot namespace documents a number of parameters that are not supported by the latest OpenSearch API version 2.12.

According to the v2.5 OpenSearch Node.js client documentation, the parameters supported by "SnapshotApi#get" are:

  • repository
  • snapshot
  • master_timeout (deprecated)
  • cluster_manager_timeout
  • ignore_unavailable
  • index_details
  • include_repository
  • verbose

According to the v2.12 OpenSearch API documentation, the parameters supported by "Get Snapshot" are:

  • repository (path parameter)
  • snapshot (path parameter)
  • verbose (query parameter)
  • ignore_unavailable (query_parameter)

In other words, the following parameters documented in the OpenSearch Node.js client documentation are NOT supported:

  • master_timeout (deprecated)
  • cluster_manager_timeout
  • index_details
  • include_repository

When I attempt to use any of these, I get a 400 Bad Request response, the error type is illegal_argument_exception, and the reason given is e.g. request [/_snapshot/<redacted-repository>/<redacted-index-name>] contains unrecognized parameter: [index_details]

How can one reproduce the bug?

My code looks like this:

const { Client } = require('@opensearch-project/opensearch');

const client = new Client({
  node: OS_SERVICE_URL,
  ssl: {
    rejectUnauthorized: false,
    key: OS_CLIENT_TLS_KEY,
    cert: OS_CLIENT_TLS_SECRET
  }
});

const params = {
  repository: REPOSITORY_NAME,
  snapshot: snapshotName,
  index_details: true
};

const options = {
  requestTimeout: REQUEST_TIMEOUT_MILLISECONDS
};

const response = await client.snapshot.get(params, options);
const snapshot = response.body.snapshots[0];

What is the expected behavior?

The parameters documented in the OpenSearch Node.js client documentation should manipulate the response in the way that the documentation describes.

What is your host/environment?

Kubernetes.

Do you have any screenshots?

No.

Do you have any additional context?

No.

@geraintwjones geraintwjones changed the title [BUG] V2.5 OpenSearch Node.js client documentation describes parameters not supported by V2.12 OpenSearch API [BUG] V2.5 OpenSearch Node.js client documentation for "Get Snapshot" describes parameters not supported by V2.12 OpenSearch API Mar 5, 2024
@nhtruong
Copy link
Collaborator

Thanks @geraintwjones. Which version of OpenSearch Cluster did your client run against?

@nhtruong
Copy link
Collaborator

I've created an issue in the spec, which is the source of the problem, to fix this:
opensearch-project/opensearch-api-specification#220

@geraintwjones
Copy link
Author

@nhtruong Ran against OS 2.11.1.

@nhtruong
Copy link
Collaborator

The master_timeout and cluster_manager_timeout params do exist. Remember to add the time unit. For example 120s for 120 seconds or 3m for 3 minutes.

@geraintwjones
Copy link
Author

@nhtruong Looking at the newer v2.13 OpenSearch API documentation, the only documented params are:

  • Path
    • repository
    • snapshot
  • Query
    • verbose
    • ignore_unavailable

Also looking at the newer v2.6 OpenSearch Node.js client documentation, if the params documented here are NOT documented in the API doc, shouldn't they be?

Please note that I haven't been able to test with the latest versions yet.

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

No branches or pull requests

2 participants