summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/delete
diff options
context:
space:
mode:
Diffstat (limited to 'rest-api-spec/test/delete')
-rw-r--r--rest-api-spec/test/delete/10_basic.yaml19
-rw-r--r--rest-api-spec/test/delete/20_internal_version.yaml28
-rw-r--r--rest-api-spec/test/delete/25_external_version.yaml32
-rw-r--r--rest-api-spec/test/delete/30_routing.yaml29
-rw-r--r--rest-api-spec/test/delete/40_parent.yaml36
-rw-r--r--rest-api-spec/test/delete/42_missing_parent.yml28
-rw-r--r--rest-api-spec/test/delete/45_parent_with_routing.yaml43
-rw-r--r--rest-api-spec/test/delete/50_refresh.yaml73
-rw-r--r--rest-api-spec/test/delete/60_missing.yaml19
-rw-r--r--rest-api-spec/test/delete/TODO.txt6
10 files changed, 313 insertions, 0 deletions
diff --git a/rest-api-spec/test/delete/10_basic.yaml b/rest-api-spec/test/delete/10_basic.yaml
new file mode 100644
index 0000000..a3671d5
--- /dev/null
+++ b/rest-api-spec/test/delete/10_basic.yaml
@@ -0,0 +1,19 @@
+---
+"Basic":
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+
+ - match: { _version: 1 }
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+
+ - match: { _version: 2 }
diff --git a/rest-api-spec/test/delete/20_internal_version.yaml b/rest-api-spec/test/delete/20_internal_version.yaml
new file mode 100644
index 0000000..3d9ddb7
--- /dev/null
+++ b/rest-api-spec/test/delete/20_internal_version.yaml
@@ -0,0 +1,28 @@
+---
+"Internal version":
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+
+ - match: { _version: 1}
+
+ - do:
+ catch: conflict
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ version: 2
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ version: 1
+
+ - match: { _version: 2 }
diff --git a/rest-api-spec/test/delete/25_external_version.yaml b/rest-api-spec/test/delete/25_external_version.yaml
new file mode 100644
index 0000000..453d64d
--- /dev/null
+++ b/rest-api-spec/test/delete/25_external_version.yaml
@@ -0,0 +1,32 @@
+---
+"External version":
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+ version_type: external
+ version: 5
+
+ - match: { _version: 5}
+
+ - do:
+ catch: conflict
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ version_type: external
+ version: 4
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ version_type: external
+ version: 6
+
+ - match: { _version: 6}
diff --git a/rest-api-spec/test/delete/30_routing.yaml b/rest-api-spec/test/delete/30_routing.yaml
new file mode 100644
index 0000000..b0d3ca3
--- /dev/null
+++ b/rest-api-spec/test/delete/30_routing.yaml
@@ -0,0 +1,29 @@
+---
+"Routing":
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ routing: 5
+ body: { foo: bar }
+ - do:
+ cluster.health:
+ wait_for_status: yellow
+
+ - do:
+ catch: missing
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ routing: 4
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ routing: 5
+
diff --git a/rest-api-spec/test/delete/40_parent.yaml b/rest-api-spec/test/delete/40_parent.yaml
new file mode 100644
index 0000000..6e8beca
--- /dev/null
+++ b/rest-api-spec/test/delete/40_parent.yaml
@@ -0,0 +1,36 @@
+---
+"Parent":
+ - do:
+ indices.create:
+ index: test_1
+ body:
+ mappings:
+ test:
+ _parent: { type: "foo" }
+ - do:
+ cluster.health:
+ wait_for_status: yellow
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+ body: { foo: bar }
+
+ - do:
+ catch: missing
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ parent: 1
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+
diff --git a/rest-api-spec/test/delete/42_missing_parent.yml b/rest-api-spec/test/delete/42_missing_parent.yml
new file mode 100644
index 0000000..ac00a8d
--- /dev/null
+++ b/rest-api-spec/test/delete/42_missing_parent.yml
@@ -0,0 +1,28 @@
+---
+"Delete on all shards when parent not specified":
+
+ - do:
+ indices.create:
+ index: test_1
+ body:
+ mappings:
+ test:
+ _parent: { type: "foo" }
+ - do:
+ cluster.health:
+ wait_for_status: yellow
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+ body: { foo: bar }
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+
diff --git a/rest-api-spec/test/delete/45_parent_with_routing.yaml b/rest-api-spec/test/delete/45_parent_with_routing.yaml
new file mode 100644
index 0000000..7a11db4
--- /dev/null
+++ b/rest-api-spec/test/delete/45_parent_with_routing.yaml
@@ -0,0 +1,43 @@
+---
+"Parent with routing":
+
+ - do:
+ indices.create:
+ index: test_1
+ body:
+ mappings:
+ test:
+ _parent: { type: "foo" }
+ settings:
+ number_of_replicas: 0
+
+ - do:
+ cluster.health:
+ wait_for_status: green
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+ routing: 4
+ body: { foo: bar }
+
+ - do:
+ catch: missing
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+ routing: 1
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ parent: 5
+ routing: 4
+
diff --git a/rest-api-spec/test/delete/50_refresh.yaml b/rest-api-spec/test/delete/50_refresh.yaml
new file mode 100644
index 0000000..b550789
--- /dev/null
+++ b/rest-api-spec/test/delete/50_refresh.yaml
@@ -0,0 +1,73 @@
+---
+"Refresh":
+
+ - do:
+ indices.create:
+ index: test_1
+ body:
+ settings:
+ refresh_interval: -1
+ number_of_replicas: 0
+ - do:
+ cluster.health:
+ wait_for_status: green
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 1
+ body: { foo: bar }
+ refresh: 1
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 2
+ body: { foo: bar }
+ refresh: 1
+
+ - do:
+ search:
+ index: test_1
+ type: test
+ body:
+ query: { terms: { _id: [1,2] }}
+
+ - match: { hits.total: 2 }
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+
+ - do:
+ search:
+ index: test_1
+ type: test
+ body:
+ query: { terms: { _id: [1,2] }}
+
+ - match: { hits.total: 2 }
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 2
+ refresh: 1
+
+# If a replica shard where doc 1 is located gets initialized at this point, doc 1
+# won't be found by the following search as the shard gets automatically refreshed
+# right before getting started. This is why this test only works with 0 replicas.
+
+ - do:
+ search:
+ index: test_1
+ type: test
+ body:
+ query: { terms: { _id: [1,2] }}
+
+ - match: { hits.total: 1 }
diff --git a/rest-api-spec/test/delete/60_missing.yaml b/rest-api-spec/test/delete/60_missing.yaml
new file mode 100644
index 0000000..9cfdb48
--- /dev/null
+++ b/rest-api-spec/test/delete/60_missing.yaml
@@ -0,0 +1,19 @@
+---
+"Missing document with catch":
+
+ - do:
+ catch: missing
+ delete:
+ index: test_1
+ type: test
+ id: 1
+
+---
+"Missing document with ignore":
+
+ - do:
+ delete:
+ index: test_1
+ type: test
+ id: 1
+ ignore: 404
diff --git a/rest-api-spec/test/delete/TODO.txt b/rest-api-spec/test/delete/TODO.txt
new file mode 100644
index 0000000..0418363
--- /dev/null
+++ b/rest-api-spec/test/delete/TODO.txt
@@ -0,0 +1,6 @@
+Tests missing for:
+
+# consistency
+# replication
+# timeout
+