Added tests for get

This commit is contained in:
Clinton Gormley 2013-06-27 11:34:24 +02:00
parent 7d0b0fb146
commit 04e6c62e1a
7 changed files with 231 additions and 0 deletions

View 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 } }

View 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 }

View 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

View 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

View 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

View 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 }

View File

@ -0,0 +1,5 @@
Tests missing for:
# preference
# refresh - what does this mean in get context?
# realtime - should we support this?