mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 14:26:27 +00:00
Added tests for exists, get_source and mget
This commit is contained in:
parent
660ec31ded
commit
00e520bcf4
35
rest-api-spec/test/exists/10_basic.yaml
Normal file
35
rest-api-spec/test/exists/10_basic.yaml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
"Basic":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- is_false: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { "foo": "bar" }
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
42
rest-api-spec/test/exists/30_parent.yaml
Normal file
42
rest-api-spec/test/exists/30_parent.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
"Parent":
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: "Parent not supported in exists https://github.com/elasticsearch/elasticsearch/issues/3276"
|
||||||
|
|
||||||
|
- 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:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- is_false: ''
|
||||||
|
|
29
rest-api-spec/test/exists/40_routing.yaml
Normal file
29
rest-api-spec/test/exists/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:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
routing: 5
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- is_false: ''
|
57
rest-api-spec/test/exists/55_parent_with_routing.yaml
Normal file
57
rest-api-spec/test/exists/55_parent_with_routing.yaml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
"Parent with routing":
|
||||||
|
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: "Parent not supported in exists https://github.com/elasticsearch/elasticsearch/issues/3276"
|
||||||
|
|
||||||
|
- 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 }
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
routing: 4
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
|
||||||
|
- is_false: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
routing: 4
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
47
rest-api-spec/test/exists/60_realtime_refresh.yaml
Normal file
47
rest-api-spec/test/exists/60_realtime_refresh.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
"Realtime 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:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 1
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 0
|
||||||
|
|
||||||
|
- is_false: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 0
|
||||||
|
refresh: 1
|
||||||
|
|
||||||
|
- is_true: ''
|
3
rest-api-spec/test/exists/TODO.txt
Normal file
3
rest-api-spec/test/exists/TODO.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Tests missing for:
|
||||||
|
|
||||||
|
# preference
|
38
rest-api-spec/test/get_source/10_basic.yaml
Normal file
38
rest-api-spec/test/get_source/10_basic.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
"Basic":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: missing
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
ignore_missing: 1
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { "foo": "bar" }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- match: { '': { foo: bar } }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
id: 1
|
||||||
|
|
||||||
|
- match: { '': { foo: bar } }
|
38
rest-api-spec/test/get_source/30_parent.yaml
Normal file
38
rest-api-spec/test/get_source/30_parent.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
"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_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
|
||||||
|
- match: { '': {foo: bar}}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: missing
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
29
rest-api-spec/test/get_source/40_routing.yaml
Normal file
29
rest-api-spec/test/get_source/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_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
routing: 5
|
||||||
|
|
||||||
|
- match: { '': {foo: bar}}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: missing
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
|
48
rest-api-spec/test/get_source/55_parent_with_routing.yaml
Normal file
48
rest-api-spec/test/get_source/55_parent_with_routing.yaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
"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_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
routing: 4
|
||||||
|
|
||||||
|
- match: { '': {foo: bar}}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: missing
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
parent: 5
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
routing: 4
|
||||||
|
|
37
rest-api-spec/test/get_source/60_realtime_refresh.yaml
Normal file
37
rest-api-spec/test/get_source/60_realtime_refresh.yaml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
"Realtime":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 1
|
||||||
|
|
||||||
|
- match: { '': {foo: bar}}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: missing
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 0
|
||||||
|
|
||||||
|
- do:
|
||||||
|
get_source:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
realtime: 0
|
||||||
|
refresh: 1
|
||||||
|
|
||||||
|
- match: { '': {foo: bar}}
|
||||||
|
|
3
rest-api-spec/test/get_source/TODO.txt
Normal file
3
rest-api-spec/test/get_source/TODO.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Tests missing for:
|
||||||
|
|
||||||
|
# preference
|
46
rest-api-spec/test/mget/10_basic.yaml
Normal file
46
rest-api-spec/test/mget/10_basic.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
"Basic multi-get":
|
||||||
|
- do:
|
||||||
|
indices.create:
|
||||||
|
index: test_2
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _index: test_2, _type: test, _id: 1}
|
||||||
|
- { _index: test_1, _type: none, _id: 1}
|
||||||
|
- { _index: test_1, _type: test, _id: 2}
|
||||||
|
- { _index: test_1, _type: test, _id: 1}
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_2 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
- match: { docs.1._index: test_1 }
|
||||||
|
- match: { docs.1._type: none }
|
||||||
|
- match: { docs.1._id: 1 }
|
||||||
|
|
||||||
|
- is_false: docs.2.exists
|
||||||
|
- match: { docs.2._index: test_1 }
|
||||||
|
- match: { docs.2._type: test }
|
||||||
|
- match: { docs.2._id: 2 }
|
||||||
|
|
||||||
|
- is_true: docs.3.exists
|
||||||
|
- match: { docs.3._index: test_1 }
|
||||||
|
- match: { docs.3._type: test }
|
||||||
|
- match: { docs.3._id: 1 }
|
||||||
|
- match: { docs.3._version: 1 }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
48
rest-api-spec/test/mget/11_default_index_type.yaml
Normal file
48
rest-api-spec/test/mget/11_default_index_type.yaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
"Default index/type":
|
||||||
|
- do:
|
||||||
|
indices.create:
|
||||||
|
index: test_2
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _index: test_2, _id: 1}
|
||||||
|
- { _type: none, _id: 1}
|
||||||
|
- { _id: 2}
|
||||||
|
- { _id: 1}
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_2 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
- match: { docs.1._index: test_1 }
|
||||||
|
- match: { docs.1._type: none }
|
||||||
|
- match: { docs.1._id: 1 }
|
||||||
|
|
||||||
|
- is_false: docs.2.exists
|
||||||
|
- match: { docs.2._index: test_1 }
|
||||||
|
- match: { docs.2._type: test }
|
||||||
|
- match: { docs.2._id: 2 }
|
||||||
|
|
||||||
|
- is_true: docs.3.exists
|
||||||
|
- match: { docs.3._index: test_1 }
|
||||||
|
- match: { docs.3._type: test }
|
||||||
|
- match: { docs.3._id: 1 }
|
||||||
|
- match: { docs.3._version: 1 }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
40
rest-api-spec/test/mget/12_non_existent_index.yaml
Normal file
40
rest-api-spec/test/mget/12_non_existent_index.yaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
"Non-existent index":
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: "See https://github.com/elasticsearch/elasticsearch/issues/3267"
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _index: test_2, _type: test, _id: 1}
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_2 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
index: test_2
|
||||||
|
docs:
|
||||||
|
- { _index: test_1, _type: test, _id: 1}
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_1 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
|
52
rest-api-spec/test/mget/13_missing_metadata.yaml
Normal file
52
rest-api-spec/test/mget/13_missing_metadata.yaml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
"Missing metadata":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ id is missing/
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _index: test_1, _type: test}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ index is missing/
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _type: test, _id: 1}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ no documents to get/
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs: []
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ no documents to get/
|
||||||
|
mget:
|
||||||
|
body: {}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _index: test_1, _id: 1}
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_1 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
- match: { docs.0._version: 1 }
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
73
rest-api-spec/test/mget/15_ids.yaml
Normal file
73
rest-api-spec/test/mget/15_ids.yaml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
---
|
||||||
|
"IDs":
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test_2
|
||||||
|
id: 2
|
||||||
|
body: { foo: baz }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
ids: [1, 2]
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_1 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
- match: { docs.0._version: 1 }
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
- match: { docs.1._index: test_1 }
|
||||||
|
- match: { docs.1._type: test }
|
||||||
|
- match: { docs.1._id: 2 }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
body:
|
||||||
|
ids: [1, 2]
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
||||||
|
- match: { docs.0._index: test_1 }
|
||||||
|
- match: { docs.0._type: test }
|
||||||
|
- match: { docs.0._id: 1 }
|
||||||
|
- match: { docs.0._version: 1 }
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
- is_true: docs.1.exists
|
||||||
|
- match: { docs.1._index: test_1 }
|
||||||
|
- match: { docs.1._type: test_2 }
|
||||||
|
- match: { docs.1._id: 2 }
|
||||||
|
- match: { docs.1._version: 1 }
|
||||||
|
- match: { docs.1._source: { foo: baz }}
|
||||||
|
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ no documents to get/
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
body:
|
||||||
|
ids: []
|
||||||
|
|
||||||
|
- do:
|
||||||
|
catch: /ActionRequestValidationException.+ no documents to get/
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
body: {}
|
||||||
|
|
111
rest-api-spec/test/mget/20_fields.yaml
Normal file
111
rest-api-spec/test/mget/20_fields.yaml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
---
|
||||||
|
"Fields":
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: "Single string fields not supported pre 0.90.3. See https://github.com/elasticsearch/elasticsearch/issues/3270"
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- is_false: docs.0.fields
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: foo
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- is_false: docs.0._source
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: [foo]
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- is_false: docs.0._source
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: [foo, _source]
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
113
rest-api-spec/test/mget/20_fields_pre_0.90.3.yaml
Normal file
113
rest-api-spec/test/mget/20_fields_pre_0.90.3.yaml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
---
|
||||||
|
"Fields":
|
||||||
|
|
||||||
|
- skip:
|
||||||
|
version: "0.90.3- 999"
|
||||||
|
reason: "Tests pre 0.90.2 for single string fields"
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- is_false: docs.0.fields
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
# - match: { docs.1.fields.foo: bar }
|
||||||
|
# - is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: foo
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- is_false: docs.0._source
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: [foo]
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- is_false: docs.0._source
|
||||||
|
|
||||||
|
- match: { docs.1.fields.foo: bar }
|
||||||
|
- is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: [foo, _source]
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, fields: foo }
|
||||||
|
- { _id: 1, fields: [foo] }
|
||||||
|
- { _id: 1, fields: [foo, _source] }
|
||||||
|
|
||||||
|
- match: { docs.0.fields.foo: bar }
|
||||||
|
- match: { docs.0._source: { foo: bar }}
|
||||||
|
|
||||||
|
# - match: { docs.1.fields.foo: bar }
|
||||||
|
# - is_false: docs.1._source
|
||||||
|
|
||||||
|
- match: { docs.2.fields.foo: bar }
|
||||||
|
- is_false: docs.2._source
|
||||||
|
|
||||||
|
- match: { docs.3.fields.foo: bar }
|
||||||
|
- match: { docs.3._source: { foo: bar }}
|
||||||
|
|
62
rest-api-spec/test/mget/30_parent.yaml
Normal file
62
rest-api-spec/test/mget/30_parent.yaml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
"Parent":
|
||||||
|
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: Parent not supported in mget. https://github.com/elasticsearch/elasticsearch/issues/3274
|
||||||
|
|
||||||
|
- 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: 4
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 2
|
||||||
|
parent: 5
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, parent: 5 }
|
||||||
|
- { _id: 1, parent: 4 }
|
||||||
|
- { _id: 2, parent: 5 }
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
|
||||||
|
- is_true: docs.2.exists
|
||||||
|
- match: { docs.2._index: test_1 }
|
||||||
|
- match: { docs.2._type: test }
|
||||||
|
- match: { docs.2._id: 1 }
|
||||||
|
- match: { docs.2.fields._parent: 4 }
|
||||||
|
- match: { docs.2.fields._routing: 4 }
|
||||||
|
|
||||||
|
- is_true: docs.3.exists
|
||||||
|
- match: { docs.3._index: test_1 }
|
||||||
|
- match: { docs.3._type: test }
|
||||||
|
- match: { docs.3._id: 2 }
|
||||||
|
- match: { docs.3.fields._parent: 5 }
|
||||||
|
- match: { docs.3.fields._routing: 5 }
|
||||||
|
|
32
rest-api-spec/test/mget/40_routing.yaml
Normal file
32
rest-api-spec/test/mget/40_routing.yaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
"Routing":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
routing: 5
|
||||||
|
body: { foo: bar }
|
||||||
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: yellow
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
fields: [_routing]
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, routing: 4 }
|
||||||
|
- { _id: 1, routing: 5 }
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
|
||||||
|
- is_true: docs.2.exists
|
||||||
|
- match: { docs.2._index: test_1 }
|
||||||
|
- match: { docs.2._type: test }
|
||||||
|
- match: { docs.2._id: 1 }
|
||||||
|
- match: { docs.2.fields._routing: 5 }
|
47
rest-api-spec/test/mget/55_parent_with_routing.yaml
Normal file
47
rest-api-spec/test/mget/55_parent_with_routing.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
"Parent":
|
||||||
|
|
||||||
|
- skip:
|
||||||
|
version: "0 - 0.90.2"
|
||||||
|
reason: Parent not supported in mget. https://github.com/elasticsearch/elasticsearch/issues/3274
|
||||||
|
|
||||||
|
- 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: 4
|
||||||
|
routing: 5
|
||||||
|
body: { foo: bar }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
body:
|
||||||
|
docs:
|
||||||
|
- { _id: 1 }
|
||||||
|
- { _id: 1, parent: 4 }
|
||||||
|
- { _id: 1, parent: 4, routing: 5 }
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
- is_false: docs.1.exists
|
||||||
|
|
||||||
|
- is_true: docs.2.exists
|
||||||
|
- match: { docs.2._index: test_1 }
|
||||||
|
- match: { docs.2._type: test }
|
||||||
|
- match: { docs.2._id: 1 }
|
||||||
|
- match: { docs.2.fields._parent: 4 }
|
||||||
|
- match: { docs.2.fields._routing: 5 }
|
||||||
|
|
50
rest-api-spec/test/mget/60_realtime_refresh.yaml
Normal file
50
rest-api-spec/test/mget/60_realtime_refresh.yaml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
"Realtime 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:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
realtime: 0
|
||||||
|
body:
|
||||||
|
ids: [1]
|
||||||
|
|
||||||
|
- is_false: docs.0.exists
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
realtime: 1
|
||||||
|
body:
|
||||||
|
ids: [1]
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
||||||
|
|
||||||
|
- do:
|
||||||
|
mget:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
realtime: 0
|
||||||
|
refresh: 1
|
||||||
|
body:
|
||||||
|
ids: [1]
|
||||||
|
|
||||||
|
- is_true: docs.0.exists
|
3
rest-api-spec/test/mget/TODO.txt
Normal file
3
rest-api-spec/test/mget/TODO.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Tests missing for:
|
||||||
|
|
||||||
|
# preference
|
Loading…
x
Reference in New Issue
Block a user