diff --git a/rest-api-spec/test/get/10_basic.yaml b/rest-api-spec/test/get/10_basic.yaml new file mode 100644 index 00000000000..e6c02f96aca --- /dev/null +++ b/rest-api-spec/test/get/10_basic.yaml @@ -0,0 +1,23 @@ +--- +"Basic GET": + - do: + catch: missing + get: + index: test_1 + type: test + id: 1 + - do: + index: + index: test_1 + type: test + id: 1 + body: { "foo": "bar" } + - do: + get: + index: test_1 + type: test + id: 1 + - match: { _index: test_1 } + - match: { _type: test } + - match: { _id: 1 } + - match: { _source: { foo: bar } } diff --git a/rest-api-spec/test/get/20_fields.yaml b/rest-api-spec/test/get/20_fields.yaml new file mode 100644 index 00000000000..0daa266ae83 --- /dev/null +++ b/rest-api-spec/test/get/20_fields.yaml @@ -0,0 +1,42 @@ +--- +"Fields": + - do: + index: + index: test_1 + type: test + id: 1 + body: { "foo": "bar", "count": 1 } + - do: + get: + index: test_1 + type: test + id: 1 + fields: foo + + - match: { _index: test_1 } + - match: { _type: test } + - match: { _id: 1 } + - match: { fields.foo: bar } + - not_ok: _source + + - do: + get: + index: test_1 + type: test + id: 1 + fields: [foo, count] + - match: { fields.foo: bar } + - match: { fields.count: 1 } + - not_ok: _source + + - do: + get: + index: test_1 + type: test + id: 1 + fields: [foo, count, _source] + - match: { fields.foo: bar } + - match: { fields.count: 1 } + - match: { _source.foo: bar } + + diff --git a/rest-api-spec/test/get/30_parent.yaml b/rest-api-spec/test/get/30_parent.yaml new file mode 100644 index 00000000000..116eeb4a9c7 --- /dev/null +++ b/rest-api-spec/test/get/30_parent.yaml @@ -0,0 +1,39 @@ +--- +"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: + get: + index: test_1 + type: test + id: 1 + parent: 5 + fields: [_parent, _routing] + - match: { _id: 1} + - match: { fields._parent: 5} + - match: { fields._routing: 5} + + - do: + catch: missing + get: + index: test_1 + type: test + id: 1 + diff --git a/rest-api-spec/test/get/40_routing.yaml b/rest-api-spec/test/get/40_routing.yaml new file mode 100644 index 00000000000..d7caddcdfae --- /dev/null +++ b/rest-api-spec/test/get/40_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: + get: + index: test_1 + type: test + id: 1 + routing: 5 + fields: [_routing] + - match: { _id: 1} + - match: { fields._routing: 5} + + - do: + catch: missing + get: + index: test_1 + type: test + id: 1 + diff --git a/rest-api-spec/test/get/55_parent_with_routing.yaml b/rest-api-spec/test/get/55_parent_with_routing.yaml new file mode 100644 index 00000000000..9cfaef09cbb --- /dev/null +++ b/rest-api-spec/test/get/55_parent_with_routing.yaml @@ -0,0 +1,49 @@ +--- +"Parent with routing": + - 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 + routing: 4 + body: { foo: bar } + + - do: + get: + index: test_1 + type: test + id: 1 + parent: 5 + routing: 4 + fields: [_parent, _routing] + - match: { _id: 1} + - match: { fields._parent: 5} + - match: { fields._routing: 4} + + - do: + catch: missing + get: + index: test_1 + type: test + id: 1 + parent: 5 + + - do: + get: + index: test_1 + type: test + id: 1 + routing: 4 + diff --git a/rest-api-spec/test/get/60_refresh.yaml b/rest-api-spec/test/get/60_refresh.yaml new file mode 100644 index 00000000000..7a2d6910b22 --- /dev/null +++ b/rest-api-spec/test/get/60_refresh.yaml @@ -0,0 +1,44 @@ +--- +"Refresh": + - do: + indices.create: + index: test_1 + body: + settings: + index.refresh_interval: -1 + - do: + cluster.health: + wait_for_status: yellow + + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + + - do: + search: + index: test_1 + type: test + body: + query: { term: { _id: 1 }} + + - match: { hits.total: 0 } + + - do: + index: + index: test_1 + type: test + id: 2 + refresh: 1 + body: { foo: bar } + + - do: + search: + index: test_1 + type: test + body: + query: { term: { _id: 2 }} + + - match: { hits.total: 1 } diff --git a/rest-api-spec/test/get/TODO.txt b/rest-api-spec/test/get/TODO.txt new file mode 100644 index 00000000000..aa4ba016dfd --- /dev/null +++ b/rest-api-spec/test/get/TODO.txt @@ -0,0 +1,5 @@ +Tests missing for: + +# preference +# refresh - what does this mean in get context? +# realtime - should we support this?