opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.85k stars 1.83k forks source link

[BUG] GET /_cat/snapshots incorrectly requires a repository #16648

Open dblock opened 1 week ago

dblock commented 1 week ago

Describe the bug

According to https://opensearch.org/docs/latest/api-reference/cat/cat-snapshots/ GET /_cat/snapshots should return all snapshots for a repository, but there's no way to specify a repository (/_cat/snapshots/{repository} works).

Instead it returns a 400 requiring a repository name.

400 (application/json) | {
  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: repository is missing;"
      }
    ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: repository is missing;"
  },
  "status": 400
}

Either the doc is incorrect and this endpoint should not be exposed without a required repository parameter, or the code is broken for /_cat/snapshots.

Related component

Storage:Snapshots

To Reproduce

curl ...

Expected behavior

Behave as described in https://opensearch.org/docs/latest/api-reference/cat/cat-snapshots/.

Additional Details

Vanilla 2.18 with path.repo=/tmp/opensearch/repo.