Procházet zdrojové kódy

Merge pull request #11928 from szroland/#11897

Create Snapshot: remove _create from POST path to match PUT

Closes #11928
Boaz Leskes před 10 roky
rodič
revize
4649650ab2

+ 1 - 1
core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java

@@ -40,7 +40,7 @@ public class RestCreateSnapshotAction extends BaseRestHandler {
     public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) {
         super(settings, controller, client);
         controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
-        controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_create", this);
+        controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this);
     }
 
     @Override

+ 1 - 1
rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.create.json

@@ -4,7 +4,7 @@
     "methods": ["PUT", "POST"],
     "url": {
       "path": "/_snapshot/{repository}/{snapshot}",
-      "paths": ["/_snapshot/{repository}/{snapshot}", "/_snapshot/{repository}/{snapshot}/_create"],
+      "paths": ["/_snapshot/{repository}/{snapshot}"],
       "parts": {
         "repository": {
           "type": "string",

+ 36 - 0
rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.create/10_basic.yaml

@@ -0,0 +1,36 @@
+---
+setup:
+
+  - do:
+      snapshot.create_repository:
+        repository: test_repo1
+        body:
+          type: fs
+          settings:
+            location: "test_repo1"
+
+  - do:
+      indices.create:
+        index: test_index
+        body:
+          settings:
+            number_of_shards:   1
+            number_of_replicas: 1
+
+  - do:
+      cluster.health:
+        wait_for_status: yellow
+
+---
+"Create a snapshot":
+
+  - do:
+      snapshot.create:
+        repository: test_repo1
+        snapshot: test_snapshot
+        wait_for_completion: true
+
+  - match: { snapshot.snapshot: test_snapshot }
+  - match: { snapshot.state : SUCCESS }
+  - match: { snapshot.shards.successful: 1 }
+  - match: { snapshot.shards.failed : 0 }