diff --git a/rest-api-spec/test/create/50_parent.yaml b/rest-api-spec/test/create/50_parent.yaml index e5db34e474f..dcd24d99346 100644 --- a/rest-api-spec/test/create/50_parent.yaml +++ b/rest-api-spec/test/create/50_parent.yaml @@ -8,6 +8,7 @@ mappings: test: _parent: { type: "foo" } + - do: cluster.health: wait_for_status: yellow @@ -40,10 +41,3 @@ - match: { fields._parent: "5"} - match: { fields._routing: "5"} - - do: - catch: param - get: - index: test_1 - type: test - id: 1 - diff --git a/rest-api-spec/test/exists/30_parent.yaml b/rest-api-spec/test/exists/30_parent.yaml index ee7b9d6f8a6..786f364ee43 100644 --- a/rest-api-spec/test/exists/30_parent.yaml +++ b/rest-api-spec/test/exists/30_parent.yaml @@ -1,5 +1,5 @@ --- -"Parent": +setup: - skip: version: "0 - 0.90.2" reason: "Parent not supported in exists https://github.com/elasticsearch/elasticsearch/issues/3276" @@ -15,6 +15,8 @@ cluster.health: wait_for_status: yellow +--- +"Parent": - do: index: index: test_1 @@ -32,8 +34,14 @@ - is_true: '' +--- +"Parent omitted pre 1.0": + + - skip: + version: "1 - 999" + reason: "Pre 1.0 omitting a parent with exists would just use the id for routing, possibly resulting in 404" + - do: - catch: param exists: index: test_1 type: test @@ -41,3 +49,21 @@ - is_false: '' + +--- +"Parent omitted post 1.0": + + - skip: + version: "0 - 0.999" + reason: "When a parent is specified in the mapping it cannot be omitted" + + - do: + catch: request + exists: + index: test_1 + type: test + id: 1 + + - is_false: '' + + diff --git a/rest-api-spec/test/get/30_parent.yaml b/rest-api-spec/test/get/30_parent.yaml index a3ad6a7e23d..964cdb43344 100644 --- a/rest-api-spec/test/get/30_parent.yaml +++ b/rest-api-spec/test/get/30_parent.yaml @@ -1,6 +1,5 @@ --- -"Parent": - +setup: - do: indices.create: index: test_1 @@ -20,6 +19,9 @@ parent: 中文 body: { foo: bar } +--- +"Parent": + - do: get: index: test_1 @@ -32,8 +34,27 @@ - match: { fields._parent: 中文 } - match: { fields._routing: 中文} +--- +"Parent omitted post 1.0": + - skip: + version: "0 - 0.999" + reason: "Required parent has been introduced in 1.0" + - do: - catch: param + catch: request + get: + index: test_1 + type: test + id: 1 + +--- +"Parent omitted pre 1.0": + - skip: + version: "1 - 999" + reason: "Required parent has been introduced in 1.0" + + - do: + catch: missing get: index: test_1 type: test diff --git a/rest-api-spec/test/get_source/30_parent.yaml b/rest-api-spec/test/get_source/30_parent.yaml index fbd6666f1d6..e5ad4f3fb5b 100644 --- a/rest-api-spec/test/get_source/30_parent.yaml +++ b/rest-api-spec/test/get_source/30_parent.yaml @@ -1,8 +1,9 @@ --- -"Parent": +setup: - skip: version: "0 - 0.90.0" reason: "Get source not supported in pre 0.90.1 versions." + - do: indices.create: index: test_1 @@ -22,6 +23,9 @@ parent: 5 body: { foo: bar } + +--- +"Parent": - do: get_source: index: test_1 @@ -31,8 +35,27 @@ - match: { '': {foo: bar}} +--- +"Parent omitted pre 1.0": + - skip: + version: "1 - 999" + reason: "Get source not supported in pre 0.90.1 versions." + - do: - catch: param + catch: missing + get_source: + index: test_1 + type: test + id: 1 + +--- +"Parent omitted post 1.0": + - skip: + version: "0 - 0.999" + reason: "Required parent has been introduced in 1.0" + + - do: + catch: request get_source: index: test_1 type: test diff --git a/rest-api-spec/test/index/50_parent.yaml b/rest-api-spec/test/index/50_parent.yaml index c4ec15b4c4b..551d30d95d7 100644 --- a/rest-api-spec/test/index/50_parent.yaml +++ b/rest-api-spec/test/index/50_parent.yaml @@ -40,10 +40,3 @@ - match: { fields._parent: "5"} - match: { fields._routing: "5"} - - do: - catch: param - get: - index: test_1 - type: test - id: 1 - diff --git a/rest-api-spec/test/update/50_parent.yaml b/rest-api-spec/test/update/50_parent.yaml index f12f98b9bfc..a55b406fc1d 100644 --- a/rest-api-spec/test/update/50_parent.yaml +++ b/rest-api-spec/test/update/50_parent.yaml @@ -1,6 +1,5 @@ --- -"Parent": - +setup: - do: indices.create: index: test_1 @@ -12,6 +11,9 @@ cluster.health: wait_for_status: yellow +--- +"Parent": + - do: catch: /RoutingMissingException/ update: @@ -43,15 +45,6 @@ - match: { fields._parent: "5"} - match: { fields._routing: "5"} - - do: - catch: param - update: - index: test_1 - type: test - id: 1 - body: - doc: { foo: baz } - - do: update: index: test_1 @@ -64,3 +57,51 @@ - match: { get.fields.foo: baz } +--- +"Parent omitted post 1.0": + + - skip: + version: "0 - 0.999" + reason: "Required parent has been introduced in 1.0" + + - do: + index: + index: test_1 + type: test + id: 1 + parent: 5 + body: { foo: bar } + + - do: + catch: request + update: + index: test_1 + type: test + id: 1 + body: + doc: { foo: baz } + +--- +"Parent omitted pre 1.0": + + - skip: + version: "1 - 999" + reason: "Required parent has been introduced in 1.0" + + - do: + index: + index: test_1 + type: test + id: 1 + parent: 5 + body: { foo: bar } + + - do: + catch: missing + update: + index: test_1 + type: test + id: 1 + body: + doc: { foo: baz } +