From 87df52278692b13fa338d4b912b15822f0fac214 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Tue, 8 Oct 2013 18:18:20 +0200 Subject: [PATCH] updated source filtering tests and spec Fixed id tests to be strings. Changed the _source_* param of get_source as they have changed in core. --- rest-api-spec/api/get_source.json | 4 ++-- .../test/explain/20_source_filtering.yaml | 2 +- .../test/get/70_source_filtering.yaml | 4 ++-- .../test/get_source/70_source_filtering.yaml | 6 ++--- .../test/indices.get_template/10_basic.yaml | 23 +++++++++++++++++++ .../test/mget/70_source_filtering.yaml | 4 ++-- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/rest-api-spec/api/get_source.json b/rest-api-spec/api/get_source.json index 5203f2b4cd4..f0c36828b33 100644 --- a/rest-api-spec/api/get_source.json +++ b/rest-api-spec/api/get_source.json @@ -24,11 +24,11 @@ } }, "params": { - "_source_exclude": { + "exclude": { "type" : "list", "description" : "A list of fields to exclude from the returned _source field" }, - "_source_include": { + "include": { "type" : "list", "description" : "A list of fields to extract and return from the _source field" }, diff --git a/rest-api-spec/test/explain/20_source_filtering.yaml b/rest-api-spec/test/explain/20_source_filtering.yaml index d085a0332f6..ce6ce5086bd 100644 --- a/rest-api-spec/test/explain/20_source_filtering.yaml +++ b/rest-api-spec/test/explain/20_source_filtering.yaml @@ -18,7 +18,7 @@ explain: { index: test_1, type: test, id: 1, _source: false, body: { query: { match_all: {}} } } - match: { _index: test_1 } - match: { _type: test } - - match: { _id: 1 } + - match: { _id: "1" } - is_false: get._source - do: diff --git a/rest-api-spec/test/get/70_source_filtering.yaml b/rest-api-spec/test/get/70_source_filtering.yaml index 4cd456d1fd6..0015e9e9724 100644 --- a/rest-api-spec/test/get/70_source_filtering.yaml +++ b/rest-api-spec/test/get/70_source_filtering.yaml @@ -15,7 +15,7 @@ - match: { _index: test_1 } - match: { _type: test } - - match: { _id: 1 } + - match: { _id: "1" } - is_false: _source - do: @@ -55,6 +55,6 @@ - match: { _index: test_1 } - match: { _type: test } - - match: { _id: 1 } + - match: { _id: "1" } - match: { fields.count: 1 } - match: { _source.include.field1: v1 } diff --git a/rest-api-spec/test/get_source/70_source_filtering.yaml b/rest-api-spec/test/get_source/70_source_filtering.yaml index 5d6c0ad0512..71c36fe3f4c 100644 --- a/rest-api-spec/test/get_source/70_source_filtering.yaml +++ b/rest-api-spec/test/get_source/70_source_filtering.yaml @@ -12,18 +12,18 @@ body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 } - do: - get_source: { index: test_1, type: test, id: 1, _source_include: include.field1 } + get_source: { index: test_1, type: test, id: 1, include: include.field1 } - match: { include.field1: v1 } - is_false: include.field2 - do: - get_source: { index: test_1, type: test, id: 1, _source_include: "include.field1,include.field2" } + get_source: { index: test_1, type: test, id: 1, include: "include.field1,include.field2" } - match: { include.field1: v1 } - match: { include.field2: v2 } - is_false: count - do: - get_source: { index: test_1, type: test, id: 1, _source_include: include, _source_exclude: "*.field2" } + get_source: { index: test_1, type: test, id: 1, include: include, exclude: "*.field2" } - match: { include.field1: v1 } - is_false: include.field2 - is_false: count diff --git a/rest-api-spec/test/indices.get_template/10_basic.yaml b/rest-api-spec/test/indices.get_template/10_basic.yaml index d031fc8e80a..a045ec7991b 100644 --- a/rest-api-spec/test/indices.get_template/10_basic.yaml +++ b/rest-api-spec/test/indices.get_template/10_basic.yaml @@ -15,3 +15,26 @@ - match: {test.template: "test-*"} - match: {test.settings: {index.number_of_shards: '1', index.number_of_replicas: '0'}} +--- +"Get all templates": + - do: + indices.put_template: + name: test + body: + template: test-* + settings: + number_of_shards: 1 + - do: + indices.put_template: + name: test2 + body: + template: test2-* + settings: + number_of_shards: 1 + + - do: + indices.get_template: {} + + - match: {test.template: "test-*"} + - match: {test2.template: "test2-*"} + diff --git a/rest-api-spec/test/mget/70_source_filtering.yaml b/rest-api-spec/test/mget/70_source_filtering.yaml index af251e6121f..e0db82a0d09 100644 --- a/rest-api-spec/test/mget/70_source_filtering.yaml +++ b/rest-api-spec/test/mget/70_source_filtering.yaml @@ -25,9 +25,9 @@ ] } - - match: { docs.0._id: 1 } + - match: { docs.0._id: "1" } - is_false: docs.0._source - - match: { docs.1._id: 2 } + - match: { docs.1._id: "2" } - is_true: docs.1._source