mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-24 13:55:57 +00:00
Added tests for get
This commit is contained in:
parent
7d0b0fb146
commit
04e6c62e1a
23
rest-api-spec/test/get/10_basic.yaml
Normal file
23
rest-api-spec/test/get/10_basic.yaml
Normal file
@ -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 } }
|
42
rest-api-spec/test/get/20_fields.yaml
Normal file
42
rest-api-spec/test/get/20_fields.yaml
Normal file
@ -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 }
|
||||
|
||||
|
39
rest-api-spec/test/get/30_parent.yaml
Normal file
39
rest-api-spec/test/get/30_parent.yaml
Normal file
@ -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
|
||||
|
29
rest-api-spec/test/get/40_routing.yaml
Normal file
29
rest-api-spec/test/get/40_routing.yaml
Normal file
@ -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
|
||||
|
49
rest-api-spec/test/get/55_parent_with_routing.yaml
Normal file
49
rest-api-spec/test/get/55_parent_with_routing.yaml
Normal file
@ -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
|
||||
|
44
rest-api-spec/test/get/60_refresh.yaml
Normal file
44
rest-api-spec/test/get/60_refresh.yaml
Normal file
@ -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 }
|
5
rest-api-spec/test/get/TODO.txt
Normal file
5
rest-api-spec/test/get/TODO.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Tests missing for:
|
||||
|
||||
# preference
|
||||
# refresh - what does this mean in get context?
|
||||
# realtime - should we support this?
|
Loading…
x
Reference in New Issue
Block a user