REST test for typeless APIs. (#33934)

This commit duplicates REST tests for the
 - `indices.create`
 - `indices.put_mapping`
 - `indices.get_mapping`
 - `index`
 - `get`
 - `delete`
 - `update`
 - `bulk`
APIs, so that we both test them when used without types (include_type_name=false)
and with types, mostly for mixed-version cluster tests.

Given a suite called `X_test_name.yml`, I first copied it to
`(X+1)_test_name_with_types.yml` and then changed `X_test_name.yml` to set
`include_type_name=false` on every API that supports it.

Relates #15613
This commit is contained in:
Adrien Grand 2018-09-26 17:11:37 +02:00 committed by GitHub
parent 7800b4fa91
commit 3c2841d493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
97 changed files with 3201 additions and 772 deletions

View File

@ -1,18 +1,22 @@
---
"Array of objects":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- index:
_index: test_index
_type: test_type
_id: test_id
- f1: v1
f2: 42
- index:
_index: test_index
_type: test_type
_id: test_id2
- f1: v2
f2: 47
@ -25,23 +29,26 @@
---
"Empty _id":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- index:
_index: test
_type: type
_id: ''
- f: 1
- index:
_index: test
_type: type
_id: id
- f: 2
- index:
_index: test
_type: type
- f: 3
- match: { errors: true }
- match: { items.0.index.status: 400 }
@ -59,12 +66,17 @@
---
"empty action":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: /Malformed action\/metadata line \[3\], expected FIELD_NAME but found \[END_OBJECT\]/
headers:
Content-Type: application/json
bulk:
include_type_name: false
body: |
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}
{"index": {"_index": "test_index", "_id": "test_id"}}
{"f1": "v1", "f2": 42}
{}

View File

@ -0,0 +1,70 @@
---
"Array of objects":
- do:
bulk:
refresh: true
body:
- index:
_index: test_index
_type: test_type
_id: test_id
- f1: v1
f2: 42
- index:
_index: test_index
_type: test_type
_id: test_id2
- f1: v2
f2: 47
- do:
count:
index: test_index
- match: {count: 2}
---
"Empty _id":
- do:
bulk:
refresh: true
body:
- index:
_index: test
_type: type
_id: ''
- f: 1
- index:
_index: test
_type: type
_id: id
- f: 2
- index:
_index: test
_type: type
- f: 3
- match: { errors: true }
- match: { items.0.index.status: 400 }
- match: { items.0.index.error.type: illegal_argument_exception }
- match: { items.0.index.error.reason: if _id is specified it must not be empty }
- match: { items.1.index.result: created }
- match: { items.2.index.result: created }
- do:
count:
index: test
- match: { count: 2 }
---
"empty action":
- do:
catch: /Malformed action\/metadata line \[3\], expected FIELD_NAME but found \[END_OBJECT\]/
headers:
Content-Type: application/json
bulk:
body: |
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}
{"f1": "v1", "f2": 42}
{}

View File

@ -1,12 +1,18 @@
---
"List of strings":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}'
- '{"index": {"_index": "test_index", "_id": "test_id"}}'
- '{"f1": "v1", "f2": 42}'
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}'
- '{"index": {"_index": "test_index", "_id": "test_id2"}}'
- '{"f1": "v2", "f2": 47}'
- do:

View File

@ -0,0 +1,17 @@
---
"List of strings":
- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}'
- '{"f1": "v1", "f2": 42}'
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}'
- '{"f1": "v2", "f2": 47}'
- do:
count:
index: test_index
- match: {count: 2}

View File

@ -1,12 +1,18 @@
---
"One big string":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body: |
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}
{"index": {"_index": "test_index", "_id": "test_id"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}
{"index": {"_index": "test_index", "_id": "test_id2"}}
{"f1": "v2", "f2": 47}
- do:

View File

@ -0,0 +1,17 @@
---
"One big string":
- do:
bulk:
refresh: true
body: |
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}
{"f1": "v2", "f2": 47}
- do:
count:
index: test_index
- match: {count: 2}

View File

@ -1,37 +1,43 @@
---
"Source filtering":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
refresh: true
index: test_index
type: test_type
id: test_id_1
body: { "foo": "bar", "bar": "foo" }
- do:
index:
include_type_name: false
refresh: true
index: test_index
type: test_type
id: test_id_2
body: { "foo": "qux", "bar": "pux" }
- do:
index:
include_type_name: false
refresh: true
index: test_index
type: test_type
id: test_id_3
body: { "foo": "corge", "bar": "forge" }
- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": true } }
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": true } }
{ "doc": { "foo": "baz" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } }
{ "update": { "_index": "test_index", "_id": "test_id_2" } }
{ "_source": true, "doc": { "foo": "quux" } }
- match: { items.0.update.get._source.foo: baz }
@ -39,8 +45,8 @@
- do:
bulk:
include_type_name: false
index: test_index
type: test_type
_source: true
body: |
{ "update": { "_id": "test_id_3" } }
@ -50,11 +56,12 @@
- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": {"includes": "bar"} } }
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": {"includes": "bar"} } }
{ "doc": { "foo": "baz" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } }
{ "update": { "_index": "test_index", "_id": "test_id_2" } }
{ "_source": {"includes": "foo"}, "doc": { "foo": "quux" } }
- match: { items.0.update.get._source.bar: foo }
@ -64,8 +71,8 @@
- do:
bulk:
include_type_name: false
index: test_index
type: test_type
_source_include: foo
body: |
{ "update": { "_id": "test_id_3" } }

View File

@ -0,0 +1,76 @@
---
"Source filtering":
- do:
index:
refresh: true
index: test_index
type: test_type
id: test_id_1
body: { "foo": "bar", "bar": "foo" }
- do:
index:
refresh: true
index: test_index
type: test_type
id: test_id_2
body: { "foo": "qux", "bar": "pux" }
- do:
index:
refresh: true
index: test_index
type: test_type
id: test_id_3
body: { "foo": "corge", "bar": "forge" }
- do:
bulk:
refresh: true
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": true } }
{ "doc": { "foo": "baz" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } }
{ "_source": true, "doc": { "foo": "quux" } }
- match: { items.0.update.get._source.foo: baz }
- match: { items.1.update.get._source.foo: quux }
- do:
bulk:
index: test_index
type: test_type
_source: true
body: |
{ "update": { "_id": "test_id_3" } }
{ "doc": { "foo": "garply" } }
- match: { items.0.update.get._source.foo: garply }
- do:
bulk:
refresh: true
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": {"includes": "bar"} } }
{ "doc": { "foo": "baz" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } }
{ "_source": {"includes": "foo"}, "doc": { "foo": "quux" } }
- match: { items.0.update.get._source.bar: foo }
- is_false: items.0.update.get._source.foo
- match: { items.1.update.get._source.foo: quux }
- is_false: items.1.update.get._source.bar
- do:
bulk:
index: test_index
type: test_type
_source_include: foo
body: |
{ "update": { "_id": "test_id_3" } }
{ "doc": { "foo": "garply" } }
- match: { items.0.update.get._source.foo: garply }
- is_false: items.0.update.get._source.bar

View File

@ -1,12 +1,18 @@
---
"refresh=true immediately makes changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body: |
{"index": {"_index": "bulk_50_refresh_1", "_type": "test_type", "_id": "bulk_50_refresh_id1"}}
{"index": {"_index": "bulk_50_refresh_1", "_id": "bulk_50_refresh_id1"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_1", "_type": "test_type", "_id": "bulk_50_refresh_id2"}}
{"index": {"_index": "bulk_50_refresh_1", "_id": "bulk_50_refresh_id2"}}
{"f1": "v2", "f2": 47}
- do:
@ -16,13 +22,19 @@
---
"refresh=empty string immediately makes changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: ""
body: |
{"index": {"_index": "bulk_50_refresh_2", "_type": "test_type", "_id": "bulk_50_refresh_id3"}}
{"index": {"_index": "bulk_50_refresh_2", "_id": "bulk_50_refresh_id3"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_2", "_type": "test_type", "_id": "bulk_50_refresh_id4"}}
{"index": {"_index": "bulk_50_refresh_2", "_id": "bulk_50_refresh_id4"}}
{"f1": "v2", "f2": 47}
- do:
@ -33,13 +45,19 @@
---
"refresh=wait_for waits until changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
bulk:
include_type_name: false
refresh: wait_for
body: |
{"index": {"_index": "bulk_50_refresh_3", "_type": "test_type", "_id": "bulk_50_refresh_id5"}}
{"index": {"_index": "bulk_50_refresh_3", "_id": "bulk_50_refresh_id5"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_3", "_type": "test_type", "_id": "bulk_50_refresh_id6"}}
{"index": {"_index": "bulk_50_refresh_3", "_id": "bulk_50_refresh_id6"}}
{"f1": "v2", "f2": 47}
- do:

View File

@ -0,0 +1,48 @@
---
"refresh=true immediately makes changes are visible in search":
- do:
bulk:
refresh: true
body: |
{"index": {"_index": "bulk_50_refresh_1", "_type": "test_type", "_id": "bulk_50_refresh_id1"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_1", "_type": "test_type", "_id": "bulk_50_refresh_id2"}}
{"f1": "v2", "f2": 47}
- do:
count:
index: bulk_50_refresh_1
- match: {count: 2}
---
"refresh=empty string immediately makes changes are visible in search":
- do:
bulk:
refresh: ""
body: |
{"index": {"_index": "bulk_50_refresh_2", "_type": "test_type", "_id": "bulk_50_refresh_id3"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_2", "_type": "test_type", "_id": "bulk_50_refresh_id4"}}
{"f1": "v2", "f2": 47}
- do:
count:
index: bulk_50_refresh_2
- match: {count: 2}
---
"refresh=wait_for waits until changes are visible in search":
- do:
bulk:
refresh: wait_for
body: |
{"index": {"_index": "bulk_50_refresh_3", "_type": "test_type", "_id": "bulk_50_refresh_id5"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "bulk_50_refresh_3", "_type": "test_type", "_id": "bulk_50_refresh_id6"}}
{"f1": "v2", "f2": 47}
- do:
count:
index: bulk_50_refresh_3
- match: {count: 2}

View File

@ -1,10 +1,14 @@
---
"Basic":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
@ -12,8 +16,16 @@
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _version: 2 }
- do:
catch: /illegal_argument_exception/
delete:
include_type_name: false
index: index
type: type
id: 1

View File

@ -1,8 +1,13 @@
---
"Delete check shard header":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: foobar
body:
settings:
@ -15,19 +20,19 @@
- do:
index:
include_type_name: false
index: foobar
type: baz
id: 1
body: { foo: bar }
- do:
delete:
include_type_name: false
index: foobar
type: baz
id: 1
- match: { _index: foobar }
- match: { _type: baz }
- is_false: "_type"
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}

View File

@ -1,17 +1,21 @@
---
"Delete result field":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
- match: { result: deleted }
@ -19,8 +23,8 @@
- do:
catch: missing
delete:
include_type_name: false
index: test_1
type: test
id: 1
- match: { result: not_found }

View File

@ -0,0 +1,19 @@
---
"Basic":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1 }
- do:
delete:
index: test_1
type: test
id: 1
- match: { _version: 2 }

View File

@ -0,0 +1,36 @@
---
"Delete check shard header":
- do:
indices.create:
index: foobar
body:
settings:
number_of_shards: "1"
number_of_replicas: "0"
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: foobar
type: baz
id: 1
body: { foo: bar }
- do:
delete:
index: foobar
type: baz
id: 1
- match: { _index: foobar }
- match: { _type: baz }
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}
- match: { _shards.successful: 1}
- match: { _shards.failed: 0}
- is_false: _shards.pending

View File

@ -0,0 +1,26 @@
---
"Delete result field":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
delete:
index: test_1
type: test
id: 1
- match: { result: deleted }
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
- match: { result: not_found }

View File

@ -1,10 +1,14 @@
---
"Internal version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
@ -13,15 +17,15 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
version: 1

View File

@ -0,0 +1,28 @@
---
"Internal version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
catch: conflict
delete:
index: test_1
type: test
id: 1
version: 2
- do:
delete:
index: test_1
type: test
id: 1
version: 1
- match: { _version: 2 }

View File

@ -1,10 +1,14 @@
---
"External version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
@ -15,16 +19,16 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
type: test
id: 1
version_type: external
version: 4
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
version_type: external
version: 6

View File

@ -1,10 +1,14 @@
---
"External GTE version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
@ -15,16 +19,16 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
type: test
id: 1
version_type: external_gte
version: 4
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
version_type: external_gte
version: 6
@ -33,8 +37,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
@ -44,8 +48,8 @@
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
version_type: external_gte
version: 6

View File

@ -0,0 +1,32 @@
---
"External version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- match: { _version: 5}
- do:
catch: conflict
delete:
index: test_1
type: test
id: 1
version_type: external
version: 4
- do:
delete:
index: test_1
type: test
id: 1
version_type: external
version: 6
- match: { _version: 6}

View File

@ -0,0 +1,53 @@
---
"External GTE version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
version: 5
- match: { _version: 5}
- do:
catch: conflict
delete:
index: test_1
type: test
id: 1
version_type: external_gte
version: 4
- do:
delete:
index: test_1
type: test
id: 1
version_type: external_gte
version: 6
- match: { _version: 6}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
version: 6
- match: { _version: 6}
- do:
delete:
index: test_1
type: test
id: 1
version_type: external_gte
version: 6
- match: { _version: 6}

View File

@ -1,16 +1,21 @@
---
"Routing":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
number_of_shards: 5
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
@ -18,15 +23,15 @@
- do:
catch: missing
delete:
include_type_name: false
index: test_1
type: test
id: 1
routing: 4
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5

View File

@ -0,0 +1,32 @@
---
"Routing":
- do:
indices.create:
index: test_1
body:
settings:
number_of_shards: 5
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
routing: 4
- do:
delete:
index: test_1
type: test
id: 1
routing: 5

View File

@ -1,8 +1,13 @@
---
"Refresh":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -16,8 +21,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: true
@ -27,8 +32,8 @@
# them to be different for this test to pass
- do:
index:
include_type_name: false
index: test_1
type: test
id: 3
body: { foo: bar }
refresh: true
@ -36,6 +41,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -44,12 +50,13 @@
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -58,8 +65,8 @@
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 3
refresh: true
@ -69,6 +76,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -77,10 +85,15 @@
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: true
@ -88,6 +101,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -95,13 +109,14 @@
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
refresh: ""
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -109,10 +124,15 @@
---
"refresh=wait_for waits until changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: delete_50_refresh_1
type: test
id: delete_50_refresh_id1
body: { foo: bar }
refresh: true
@ -120,6 +140,7 @@
- do:
search:
include_type_name: false
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}
@ -127,14 +148,15 @@
- do:
delete:
include_type_name: false
index: delete_50_refresh_1
type: test
id: delete_50_refresh_id1
refresh: wait_for
- is_false: forced_refresh
- do:
search:
include_type_name: false
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}

View File

@ -0,0 +1,141 @@
---
"Refresh":
- do:
indices.create:
index: test_1
body:
settings:
refresh_interval: -1
number_of_shards: 5
number_of_routing_shards: 5
number_of_replicas: 0
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: true
# If you wonder why this document get 3 as an id instead of 2, it is because the
# current routing algorithm would route 1 and 2 to the same shard while we need
# them to be different for this test to pass
- do:
index:
index: test_1
type: test
id: 3
body: { foo: bar }
refresh: true
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { terms: { _id: [1,3] }}
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 1
- do:
search:
index: test_1
body:
query: { terms: { _id: [1,3] }}
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 3
refresh: true
# If a replica shard where doc 1 is located gets initialized at this point, doc 1
# won't be found by the following search as the shard gets automatically refreshed
# right before getting started. This is why this test only works with 0 replicas.
- do:
search:
index: test_1
body:
query: { terms: { _id: [1,3] }}
- match: { hits.total: 1 }
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: true
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 1 }
- do:
delete:
index: test_1
type: test
id: 1
refresh: ""
- do:
search:
index: test_1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
---
"refresh=wait_for waits until changes are visible in search":
- do:
index:
index: delete_50_refresh_1
type: test
id: delete_50_refresh_id1
body: { foo: bar }
refresh: true
- is_true: forced_refresh
- do:
search:
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}
- match: { hits.total: 1 }
- do:
delete:
index: delete_50_refresh_1
type: test
id: delete_50_refresh_id1
refresh: wait_for
- is_false: forced_refresh
- do:
search:
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}
- match: { hits.total: 0 }

View File

@ -1,19 +1,27 @@
---
"Missing document with catch":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: missing
delete:
include_type_name: false
index: test_1
type: test
id: 1
---
"Missing document with ignore":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
delete:
include_type_name: false
index: test_1
type: test
id: 1
ignore: 404

View File

@ -0,0 +1,19 @@
---
"Missing document with catch":
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
---
"Missing document with ignore":
- do:
delete:
index: test_1
type: test
id: 1
ignore: 404

View File

@ -1,31 +1,32 @@
---
"Basic":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 中文
body: { "foo": "Hello: 中文" }
- do:
get:
include_type_name: false
index: test_1
type: test
id: 中文
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: 中文 }
- match: { _source: { foo: "Hello: 中文" } }
- do:
catch: /illegal_argument_exception/
get:
index: test_1
type: _all
id: 中文
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: 中文 }
- match: { _source: { foo: "Hello: 中文" } }
index: index
type: type
id: 1
include_type_name: false

View File

@ -0,0 +1,31 @@
---
"Basic":
- do:
index:
index: test_1
type: test
id: 中文
body: { "foo": "Hello: 中文" }
- do:
get:
index: test_1
type: test
id: 中文
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: 中文 }
- match: { _source: { foo: "Hello: 中文" } }
- do:
get:
index: test_1
type: _all
id: 中文
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: 中文 }
- match: { _source: { foo: "Hello: 中文" } }

View File

@ -1,21 +1,25 @@
---
"Default values":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { "foo": "bar" }
- do:
get:
include_type_name: false
index: test_1
type: _all
id: 1
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: '1' }
- match: { _source: { foo: "bar" } }

View File

@ -0,0 +1,21 @@
---
"Default values":
- do:
index:
index: test_1
type: test
id: 1
body: { "foo": "bar" }
- do:
get:
index: test_1
type: _all
id: 1
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: '1' }
- match: { _source: { foo: "bar" } }

View File

@ -1,43 +1,47 @@
---
"Stored fields":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
mappings:
test:
properties:
foo:
type: keyword
store: true
count:
type: integer
store: true
properties:
foo:
type: keyword
store: true
count:
type: integer
store: true
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { "foo": "bar", "count": 1 }
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
stored_fields: foo
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: '1' }
- match: { fields.foo: [bar] }
- is_false: _source
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
stored_fields: [foo, count]
@ -47,8 +51,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
stored_fields: [foo, count, _source]

View File

@ -0,0 +1,59 @@
---
"Stored fields":
- do:
indices.create:
index: test_1
body:
mappings:
test:
properties:
foo:
type: keyword
store: true
count:
type: integer
store: true
- do:
index:
index: test_1
type: test
id: 1
body: { "foo": "bar", "count": 1 }
- do:
get:
index: test_1
type: test
id: 1
stored_fields: foo
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: '1' }
- match: { fields.foo: [bar] }
- is_false: _source
- do:
get:
index: test_1
type: test
id: 1
stored_fields: [foo, count]
- match: { fields.foo: [bar] }
- match: { fields.count: [1] }
- is_false: _source
- do:
get:
index: test_1
type: test
id: 1
stored_fields: [foo, count, _source]
- match: { fields.foo: [bar] }
- match: { fields.count: [1] }
- match: { _source.foo: bar }

View File

@ -1,8 +1,13 @@
---
"Routing":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -17,16 +22,16 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
stored_fields: [_routing]
@ -37,7 +42,7 @@
- do:
catch: missing
get:
include_type_name: false
index: test_1
type: test
id: 1

View File

@ -0,0 +1,43 @@
---
"Routing":
- do:
indices.create:
index: test_1
body:
settings:
index:
number_of_shards: 5
number_of_routing_shards: 5
number_of_replicas: 0
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
routing: 5
stored_fields: [_routing]
- match: { _id: "1"}
- match: { _routing: "5"}
- do:
catch: missing
get:
index: test_1
type: test
id: 1

View File

@ -2,11 +2,13 @@
"REST test with headers":
- skip:
features: ["headers", "yaml"]
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { "body": "foo" }
@ -14,12 +16,12 @@
headers:
Accept: application/yaml
get:
include_type_name: false
index: test_1
type: _all
id: 1
- match: {_index: "test_1"}
- match: {_type: "test"}
- is_false: "_type"
- match: {_id: "1"}
- match: {_version: 1}
- match: {found: true}

View File

@ -0,0 +1,26 @@
---
"REST test with headers":
- skip:
features: ["headers", "yaml"]
- do:
index:
index: test_1
type: test
id: 1
body: { "body": "foo" }
- do:
headers:
Accept: application/yaml
get:
index: test_1
type: _all
id: 1
- match: {_index: "test_1"}
- match: {_type: "test"}
- match: {_id: "1"}
- match: {_version: 1}
- match: {found: true}
- match: { _source: { body: foo }}

View File

@ -1,8 +1,13 @@
---
"Realtime Refresh":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -16,23 +21,23 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
catch: missing
get:
include_type_name: false
index: test_1
type: test
id: 1
realtime: false
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
realtime: true
@ -40,8 +45,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
realtime: false
refresh: true

View File

@ -0,0 +1,49 @@
---
"Realtime Refresh":
- do:
indices.create:
index: test_1
body:
settings:
index:
refresh_interval: -1
number_of_replicas: 0
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
catch: missing
get:
index: test_1
type: test
id: 1
realtime: false
- do:
get:
index: test_1
type: test
id: 1
realtime: true
- is_true: found
- do:
get:
index: test_1
type: test
id: 1
realtime: false
refresh: true
- is_true: found

View File

@ -1,53 +1,57 @@
---
"Source filtering":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
mappings:
test:
properties:
count:
type: integer
store: true
properties:
count:
type: integer
store: true
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
- do:
get: { index: test_1, type: test, id: 1, _source: false }
get: { include_type_name: false, index: test_1, id: 1, _source: false }
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: "1" }
- is_false: _source
- do:
get: { index: test_1, type: test, id: 1, _source: true }
get: { include_type_name: false, index: test_1, id: 1, _source: true }
- match: { _source.include.field1: v1 }
- do:
get: { index: test_1, type: test, id: 1, _source: include.field1 }
get: { include_type_name: false, index: test_1, id: 1, _source: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { index: test_1, type: test, id: 1, _source_include: include.field1 }
get: { include_type_name: false, index: test_1, id: 1, _source_include: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { index: test_1, type: test, id: 1, _source_include: "include.field1,include.field2" }
get: { include_type_name: false, index: test_1, id: 1, _source_include: "include.field1,include.field2" }
- match: { _source.include.field1: v1 }
- match: { _source.include.field2: v2 }
- is_false: _source.count
- do:
get: { index: test_1, type: test, id: 1, _source_include: include, _source_exclude: "*.field2" }
get: { include_type_name: false, index: test_1, id: 1, _source_include: include, _source_exclude: "*.field2" }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- is_false: _source.count
@ -55,14 +59,14 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
stored_fields: count
_source: true
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: "1" }
- match: { fields.count: [1] }
- match: { _source.include.field1: v1 }

View File

@ -0,0 +1,68 @@
---
"Source filtering":
- do:
indices.create:
index: test_1
body:
mappings:
test:
properties:
count:
type: integer
store: true
- do:
index:
index: test_1
type: test
id: 1
body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
- do:
get: { index: test_1, type: test, id: 1, _source: false }
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: "1" }
- is_false: _source
- do:
get: { index: test_1, type: test, id: 1, _source: true }
- match: { _source.include.field1: v1 }
- do:
get: { index: test_1, type: test, id: 1, _source: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { index: test_1, type: test, id: 1, _source_include: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { index: test_1, type: test, id: 1, _source_include: "include.field1,include.field2" }
- match: { _source.include.field1: v1 }
- match: { _source.include.field2: v2 }
- is_false: _source.count
- do:
get: { index: test_1, type: test, id: 1, _source_include: include, _source_exclude: "*.field2" }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- is_false: _source.count
- do:
get:
index: test_1
type: test
id: 1
stored_fields: count
_source: true
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: "1" }
- match: { fields.count: [1] }
- match: { _source.include.field1: v1 }

View File

@ -1,19 +1,27 @@
---
"Missing document with catch":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: missing
get:
include_type_name: false
index: test_1
type: test
id: 1
---
"Missing document with ignore":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
ignore: 404

View File

@ -0,0 +1,19 @@
---
"Missing document with catch":
- do:
catch: missing
get:
index: test_1
type: test
id: 1
---
"Missing document with ignore":
- do:
get:
index: test_1
type: test
id: 1
ignore: 404

View File

@ -1,26 +1,30 @@
---
"Versions":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 2}
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
- match: { _id: "1" }
@ -28,15 +32,15 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 1
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
version_type: external
@ -45,8 +49,8 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 10
version_type: external
@ -54,16 +58,16 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 1
version_type: external
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
version_type: external_gte
@ -72,8 +76,8 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 10
version_type: external_gte
@ -81,8 +85,8 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
type: test
id: 1
version: 1
version_type: external_gte

View File

@ -0,0 +1,89 @@
---
"Versions":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 2}
- do:
get:
index: test_1
type: test
id: 1
version: 2
- match: { _id: "1" }
- do:
catch: conflict
get:
index: test_1
type: test
id: 1
version: 1
- do:
get:
index: test_1
type: test
id: 1
version: 2
version_type: external
- match: { _id: "1" }
- do:
catch: conflict
get:
index: test_1
type: test
id: 1
version: 10
version_type: external
- do:
catch: conflict
get:
index: test_1
type: test
id: 1
version: 1
version_type: external
- do:
get:
index: test_1
type: test
id: 1
version: 2
version_type: external_gte
- match: { _id: "1" }
- do:
catch: conflict
get:
index: test_1
type: test
id: 1
version: 10
version_type: external_gte
- do:
catch: conflict
get:
index: test_1
type: test
id: 1
version: 1
version_type: external_gte

View File

@ -1,26 +1,30 @@
---
"Index with ID":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test-weird-index-中文
type: weird.type
id: 1
body: { foo: bar }
- match: { _index: test-weird-index-中文 }
- match: { _type: weird.type }
- is_false: "_type"
- match: { _id: "1"}
- match: { _version: 1}
- do:
get:
include_type_name: false
index: test-weird-index-中文
type: weird.type
id: 1
- match: { _index: test-weird-index-中文 }
- match: { _type: weird.type }
- is_false: "_type"
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}
@ -28,7 +32,16 @@
- do:
catch: bad_request
index:
include_type_name: false
index: idx
type: type
id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
body: { foo: bar }
- do:
catch: /illegal_argument_exception/
index:
index: index
type: type
id: 1
include_type_name: false
body: { foo: bar }

View File

@ -0,0 +1,34 @@
---
"Index with ID":
- do:
index:
index: test-weird-index-中文
type: weird.type
id: 1
body: { foo: bar }
- match: { _index: test-weird-index-中文 }
- match: { _type: weird.type }
- match: { _id: "1"}
- match: { _version: 1}
- do:
get:
index: test-weird-index-中文
type: weird.type
id: 1
- match: { _index: test-weird-index-中文 }
- match: { _type: weird.type }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}
- do:
catch: bad_request
index:
index: idx
type: type
id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
body: { foo: bar }

View File

@ -1,10 +1,14 @@
---
"Index result field":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_index
type: test
id: 1
body: { foo: bar }
@ -12,8 +16,8 @@
- do:
index:
include_type_name: false
index: test_index
type: test
id: 1
body: { foo: bar }
op_type: index

View File

@ -0,0 +1,21 @@
---
"Index result field":
- do:
index:
index: test_index
type: test
id: 1
body: { foo: bar }
- match: { result: created }
- do:
index:
index: test_index
type: test
id: 1
body: { foo: bar }
op_type: index
- match: { result: updated }

View File

@ -1,26 +1,38 @@
---
"Index without ID":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
body: { foo: bar }
- is_true: _id
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
include_type_name: false
index: test_1
type: test
id: '$id'
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}
- do:
catch: /illegal_argument_exception/
index:
index: index
type: type
include_type_name: false
body: { foo: bar }

View File

@ -0,0 +1,26 @@
---
"Index without ID":
- do:
index:
index: test_1
type: test
body: { foo: bar }
- is_true: _id
- match: { _index: test_1 }
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
index: test_1
type: test
id: '$id'
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}

View File

@ -1,10 +1,14 @@
---
"Optype":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
@ -12,16 +16,16 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
op_type: index
body: { foo: bar }

View File

@ -0,0 +1,29 @@
---
"Optype":
- do:
index:
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
- do:
index:
index: test_1
type: test
id: 1
op_type: index
body: { foo: bar }
- match: { _version: 2 }

View File

@ -1,18 +1,22 @@
---
"Internal version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 2}
@ -20,15 +24,15 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version: 1
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version: 2

View File

@ -0,0 +1,36 @@
---
"Internal version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 2}
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version: 1
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version: 2
- match: { _version: 3 }

View File

@ -1,10 +1,14 @@
---
"External version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
@ -14,8 +18,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
@ -26,8 +30,8 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
@ -36,8 +40,8 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
@ -45,8 +49,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external

View File

@ -1,10 +1,14 @@
---
"External GTE version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
@ -14,8 +18,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
@ -26,8 +30,8 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
@ -35,8 +39,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar2 }
version_type: external_gte
@ -46,8 +50,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar2 }
version_type: external_gte

View File

@ -0,0 +1,55 @@
---
"External version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 0
- match: { _version: 0 }
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- match: { _version: 5 }
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 0
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 6
- match: { _version: 6}

View File

@ -0,0 +1,56 @@
---
"External GTE version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
version: 0
- match: { _version: 0}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
version: 5
- match: { _version: 5}
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external_gte
version: 0
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar2 }
version_type: external_gte
version: 5
- match: { _version: 5}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar2 }
version_type: external_gte
version: 6
- match: { _version: 6}

View File

@ -1,8 +1,13 @@
---
"Routing":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -17,16 +22,16 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
stored_fields: [_routing]
@ -37,7 +42,7 @@
- do:
catch: missing
get:
include_type_name: false
index: test_1
type: test
id: 1

View File

@ -0,0 +1,43 @@
---
"Routing":
- do:
indices.create:
index: test_1
body:
settings:
index:
number_of_shards: 5
number_of_routing_shards: 5
number_of_replicas: 0
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
routing: 5
stored_fields: [_routing]
- match: { _id: "1"}
- match: { _routing: "5"}
- do:
catch: missing
get:
index: test_1
type: test
id: 1

View File

@ -1,8 +1,13 @@
---
"Refresh":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -11,13 +16,14 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -26,8 +32,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 2
refresh: true
body: { foo: bar }
@ -35,6 +41,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 2 }}
@ -43,10 +50,15 @@
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
refresh: ""
body: { foo: bar }
@ -54,6 +66,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -62,10 +75,15 @@
---
"refresh=wait_for waits until changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: index_60_refresh_1
type: test
id: index_60_refresh_id1
body: { foo: bar }
refresh: wait_for
@ -73,6 +91,7 @@
- do:
search:
include_type_name: false
index: index_60_refresh_1
body:
query: { term: { _id: index_60_refresh_id1 }}

View File

@ -0,0 +1,79 @@
---
"Refresh":
- do:
indices.create:
index: test_1
body:
settings:
index.refresh_interval: -1
number_of_replicas: 0
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
search:
index: test_1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
- do:
index:
index: test_1
type: test
id: 2
refresh: true
body: { foo: bar }
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { term: { _id: 2 }}
- match: { hits.total: 1 }
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- do:
index:
index: test_1
type: test
id: 1
refresh: ""
body: { foo: bar }
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 1 }
---
"refresh=wait_for waits until changes are visible in search":
- do:
index:
index: index_60_refresh_1
type: test
id: index_60_refresh_id1
body: { foo: bar }
refresh: wait_for
- is_false: forced_refresh
- do:
search:
index: index_60_refresh_1
body:
query: { term: { _id: index_60_refresh_id1 }}
- match: { hits.total: 1 }

View File

@ -1,24 +1,35 @@
---
"Create index with mappings":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
body:
mappings:
type_1: {}
{}
- do:
indices.get_mapping:
include_type_name: false
index: test_index
- is_true: test_index.mappings.type_1
- is_true: test_index.mappings
---
"Create index with settings":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
body:
settings:
@ -33,8 +44,13 @@
---
"Create index":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
- match: { acknowledged: true }
@ -43,8 +59,13 @@
---
"Create index with wait_for_active_shards set to all":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
wait_for_active_shards: all
body:
@ -57,15 +78,19 @@
---
"Create index with aliases":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
body:
mappings:
type_1:
properties:
field:
type: text
properties:
field:
type: text
aliases:
test_alias: {}
test_blias:
@ -93,6 +118,7 @@
reason: is_write_index is not implemented in ES <= 6.x
- do:
indices.create:
include_type_name: false
index: test_index
body:
aliases:
@ -110,25 +136,15 @@
- is_false: test_index.aliases.test_blias.is_write_index
- is_true: test_index.aliases.test_clias.is_write_index
---
"Create index with no type mappings":
- do:
catch: /illegal_argument_exception/
indices.create:
index: test_index
body:
mappings:
"" : {}
---
"Create index with invalid mappings":
- do:
catch: /illegal_argument_exception/
indices.create:
include_type_name: false
index: test_index
body:
mappings:
test_type:
properties:
"":
type: keyword
properties:
"":
type: keyword

View File

@ -0,0 +1,134 @@
---
"Create index with mappings":
- do:
indices.create:
index: test_index
body:
mappings:
type_1: {}
- do:
indices.get_mapping:
index: test_index
- is_true: test_index.mappings.type_1
---
"Create index with settings":
- do:
indices.create:
index: test_index
body:
settings:
number_of_replicas: "0"
- do:
indices.get_settings:
index: test_index
- match: { test_index.settings.index.number_of_replicas: "0"}
---
"Create index":
- do:
indices.create:
index: test_index
- match: { acknowledged: true }
- match: { index: "test_index"}
---
"Create index with wait_for_active_shards set to all":
- do:
indices.create:
index: test_index
wait_for_active_shards: all
body:
settings:
number_of_replicas: "0"
- match: { acknowledged: true }
- match: { shards_acknowledged: true }
---
"Create index with aliases":
- do:
indices.create:
index: test_index
body:
mappings:
type_1:
properties:
field:
type: text
aliases:
test_alias: {}
test_blias:
routing: b
test_clias:
filter:
term:
field : value
- do:
indices.get_alias:
index: test_index
- match: {test_index.aliases.test_blias.search_routing: b}
- match: {test_index.aliases.test_blias.index_routing: b}
- is_false: test_index.aliases.test_blias.filter
- match: {test_index.aliases.test_clias.filter.term.field: value}
- is_false: test_index.aliases.test_clias.index_routing
- is_false: test_index.aliases.test_clias.search_routing
---
"Create index with write aliases":
- skip:
version: " - 6.99.99"
reason: is_write_index is not implemented in ES <= 6.x
- do:
indices.create:
index: test_index
body:
aliases:
test_alias: {}
test_blias:
is_write_index: false
test_clias:
is_write_index: true
- do:
indices.get_alias:
index: test_index
- is_false: test_index.aliases.test_alias.is_write_index
- is_false: test_index.aliases.test_blias.is_write_index
- is_true: test_index.aliases.test_clias.is_write_index
---
"Create index with no type mappings":
- do:
catch: /illegal_argument_exception/
indices.create:
index: test_index
body:
mappings:
"" : {}
---
"Create index with invalid mappings":
- do:
catch: /illegal_argument_exception/
indices.create:
index: test_index
body:
mappings:
test_type:
properties:
"":
type: keyword

View File

@ -1,26 +1,32 @@
---
setup:
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
mappings:
doc: {}
mappings: {}
- do:
indices.create:
include_type_name: false
index: test_2
body:
mappings:
doc: {}
mappings: {}
---
"Get /{index}/_mapping with empty mappings":
- do:
indices.create:
include_type_name: false
index: t
- do:
indices.get_mapping:
include_type_name: false
index: t
- match: { t.mappings: {}}
@ -29,116 +35,65 @@ setup:
"Get /_mapping":
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
- is_true: test_1.mappings
- is_true: test_2.mappings
---
"Get /{index}/_mapping":
- do:
indices.get_mapping:
index: test_1
include_type_name: false
index: test_1
- is_true: test_1.mappings.doc
- is_true: test_1.mappings
- is_false: test_2
---
"Get /{index}/_mapping/_all":
"Get /_all/_mapping":
- do:
indices.get_mapping:
index: test_1
type: _all
include_type_name: false
index: _all
- is_true: test_1.mappings.doc
- is_false: test_2
- is_true: test_1.mappings
- is_true: test_2.mappings
---
"Get /{index}/_mapping/*":
"Get /*/_mapping":
- do:
indices.get_mapping:
index: test_1
type: '*'
include_type_name: false
index: '*'
- is_true: test_1.mappings.doc
- is_false: test_2
- is_true: test_1.mappings
- is_true: test_2.mappings
---
"Get /{index}/_mapping/{type}":
"Get /index,index/_mapping":
- do:
indices.get_mapping:
index: test_1
type: doc
include_type_name: false
index: test_1,test_2
- is_true: test_1.mappings.doc
- is_false: test_2
- is_true: test_1.mappings
- is_true: test_2.mappings
---
"Get /{index}/_mapping/{type*}":
"Get /index*/_mapping/":
- do:
indices.get_mapping:
index: test_1
type: 'd*'
include_type_name: false
index: '*2'
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /_mapping/{type}":
- do:
indices.get_mapping:
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /_all/_mapping/{type}":
- do:
indices.get_mapping:
index: _all
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /*/_mapping/{type}":
- do:
indices.get_mapping:
index: '*'
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /index,index/_mapping/{type}":
- do:
indices.get_mapping:
index: test_1,test_2
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /index*/_mapping/{type}":
- do:
indices.get_mapping:
index: '*2'
type: doc
- is_true: test_2.mappings.doc
- is_true: test_2.mappings
- is_false: test_1

View File

@ -0,0 +1,144 @@
---
setup:
- do:
indices.create:
index: test_1
body:
mappings:
doc: {}
- do:
indices.create:
index: test_2
body:
mappings:
doc: {}
---
"Get /{index}/_mapping with empty mappings":
- do:
indices.create:
index: t
- do:
indices.get_mapping:
index: t
- match: { t.mappings: {}}
---
"Get /_mapping":
- do:
indices.get_mapping: {}
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /{index}/_mapping":
- do:
indices.get_mapping:
index: test_1
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /{index}/_mapping/_all":
- do:
indices.get_mapping:
index: test_1
type: _all
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /{index}/_mapping/*":
- do:
indices.get_mapping:
index: test_1
type: '*'
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /{index}/_mapping/{type}":
- do:
indices.get_mapping:
index: test_1
type: doc
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /{index}/_mapping/{type*}":
- do:
indices.get_mapping:
index: test_1
type: 'd*'
- is_true: test_1.mappings.doc
- is_false: test_2
---
"Get /_mapping/{type}":
- do:
indices.get_mapping:
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /_all/_mapping/{type}":
- do:
indices.get_mapping:
index: _all
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /*/_mapping/{type}":
- do:
indices.get_mapping:
index: '*'
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /index,index/_mapping/{type}":
- do:
indices.get_mapping:
index: test_1,test_2
type: doc
- is_true: test_1.mappings.doc
- is_true: test_2.mappings.doc
---
"Get /index*/_mapping/{type}":
- do:
indices.get_mapping:
index: '*2'
type: doc
- is_true: test_2.mappings.doc
- is_false: test_1

View File

@ -1,69 +1,104 @@
---
"Test Create and update mapping":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
- do:
indices.put_mapping:
include_type_name: false
index: test_index
type: test_type
body:
test_type:
properties:
text1:
type: text
analyzer: whitespace
text2:
type: text
analyzer: whitespace
subfield.text3:
type: text
properties:
text1:
type: text
analyzer: whitespace
text2:
type: text
analyzer: whitespace
subfield.text3:
type: text
- do:
indices.get_mapping:
include_type_name: false
index: test_index
- match: {test_index.mappings.test_type.properties.text1.type: text}
- match: {test_index.mappings.test_type.properties.text1.analyzer: whitespace}
- match: {test_index.mappings.test_type.properties.text2.type: text}
- match: {test_index.mappings.test_type.properties.text2.analyzer: whitespace}
- match: {test_index.mappings.properties.text1.type: text}
- match: {test_index.mappings.properties.text1.analyzer: whitespace}
- match: {test_index.mappings.properties.text2.type: text}
- match: {test_index.mappings.properties.text2.analyzer: whitespace}
- do:
indices.put_mapping:
include_type_name: false
index: test_index
type: test_type
body:
test_type:
properties:
text1:
type: text
analyzer: whitespace
fields:
text_raw:
type: keyword
properties:
text1:
type: text
analyzer: whitespace
fields:
text_raw:
type: keyword
- do:
indices.get_mapping:
include_type_name: false
index: test_index
- match: {test_index.mappings.test_type.properties.text1.type: text}
- match: {test_index.mappings.test_type.properties.subfield.properties.text3.type: text}
- match: {test_index.mappings.test_type.properties.text1.fields.text_raw.type: keyword}
- match: {test_index.mappings.properties.text1.type: text}
- match: {test_index.mappings.properties.subfield.properties.text3.type: text}
- match: {test_index.mappings.properties.text1.fields.text_raw.type: keyword}
---
"Create index with invalid mappings":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index
- do:
catch: /illegal_argument_exception/
indices.put_mapping:
include_type_name: false
index: test_index
type: test_type
body:
test_type:
properties:
"":
type: keyword
properties:
"":
type: keyword
---
"PUT mapping with a type and include_type_name: false":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
catch: /illegal_argument_exception/
indices.put_mapping:
index: index
type: _doc
include_type_name: false
body:
properties:
bar:
type: float

View File

@ -0,0 +1,69 @@
---
"Test Create and update mapping":
- do:
indices.create:
index: test_index
- do:
indices.put_mapping:
index: test_index
type: test_type
body:
test_type:
properties:
text1:
type: text
analyzer: whitespace
text2:
type: text
analyzer: whitespace
subfield.text3:
type: text
- do:
indices.get_mapping:
index: test_index
- match: {test_index.mappings.test_type.properties.text1.type: text}
- match: {test_index.mappings.test_type.properties.text1.analyzer: whitespace}
- match: {test_index.mappings.test_type.properties.text2.type: text}
- match: {test_index.mappings.test_type.properties.text2.analyzer: whitespace}
- do:
indices.put_mapping:
index: test_index
type: test_type
body:
test_type:
properties:
text1:
type: text
analyzer: whitespace
fields:
text_raw:
type: keyword
- do:
indices.get_mapping:
index: test_index
- match: {test_index.mappings.test_type.properties.text1.type: text}
- match: {test_index.mappings.test_type.properties.subfield.properties.text3.type: text}
- match: {test_index.mappings.test_type.properties.text1.fields.text_raw.type: keyword}
---
"Create index with invalid mappings":
- do:
indices.create:
index: test_index
- do:
catch: /illegal_argument_exception/
indices.put_mapping:
index: test_index
type: test_type
body:
test_type:
properties:
"":
type: keyword

View File

@ -1,334 +0,0 @@
---
"Create indices and manage mappings without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
body:
mappings:
properties:
foo:
type: keyword
- do:
indices.get_mapping:
index: index
include_type_name: false
- match: { index.mappings.properties.foo.type: "keyword" }
- do:
indices.put_mapping:
index: index
include_type_name: false
body:
properties:
bar:
type: float
- do:
indices.get_mapping:
index: index
include_type_name: false
- match: { index.mappings.properties.foo.type: "keyword" }
- match: { index.mappings.properties.bar.type: "float" }
---
"Index explicit IDs without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
include_type_name: false
index: index
id: 1
body: { foo: bar }
- match: { "_index": "index" }
- is_false: _type
- do:
bulk:
index: index
include_type_name: false
body: |
{ "index": { "_id": "2" } }
{ "doc": { "foo": "baz" } }
- match: { "items.0.index._index": "index" }
- is_false: items.0.index._type
---
"Index implicit IDs without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
index: index
include_type_name: false
body: { foo: bar }
- match: { "_index": "index" }
- is_false: _type
- do:
bulk:
index: index
include_type_name: false
body: |
{ "index": { } }
{ "doc": { "foo": "baz" } }
- match: { "items.0.index._index": "index" }
- is_false: items.0.index._type
---
"Mixing include_type_name=false with explicit types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
catch: /illegal_argument_exception/
index:
index: index
type: type
id: 1
include_type_name: false
body: { foo: bar }
- do:
catch: /illegal_argument_exception/
index:
index: index
type: type
include_type_name: false
body: { foo: bar }
- do:
catch: /illegal_argument_exception/
get:
index: index
type: type
id: 1
include_type_name: false
- do:
catch: /illegal_argument_exception/
update:
index: index
type: type
id: 1
include_type_name: false
body:
doc: { foo: baz }
- do:
catch: /illegal_argument_exception/
delete:
index: index
type: type
id: 1
include_type_name: false
- do:
catch: /illegal_argument_exception/
search:
index: index
type: type
include_type_name: false
- do:
catch: /illegal_argument_exception/
search:
index: index
type: _doc
include_type_name: false
---
"Update API without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
index: index
id: 1
include_type_name: false
body: { "foo": "bar" }
- do:
update:
index: index
id: 1
include_type_name: false
body:
doc: { "foo": "baz" }
- match: { "_index": "index" }
- is_false: _type
---
"GET API without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
index: index
id: 1
include_type_name: false
body: { "foo": "bar" }
- do:
get:
index: index
id: 1
include_type_name: false
- match: { "_index": "index" }
- is_false: _type
---
"Delete API without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
index: index
id: 1
include_type_name: false
body: { "foo": "bar" }
- do:
delete:
index: index
id: 1
include_type_name: false
- match: { "_index": "index" }
- is_false: _type
---
"Search without types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
index:
index: index
id: 1
include_type_name: false
body: { "foo": "bar" }
- do:
indices.refresh:
index: index
- do:
search:
index: index
include_type_name: false
- match: { "hits.total": 1 }
- match: { "hits.hits.0._index": "index" }
- is_false: hits.hits.0._type
---
"PUT mapping with a type and include_type_name: false":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
catch: /illegal_argument_exception/
indices.put_mapping:
index: index
type: _doc
include_type_name: false
body:
properties:
bar:
type: float
---
"GET mappings on empty index with the include_type_name=false option":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
index: index
include_type_name: false
- do:
indices.get_mapping:
index: index
include_type_name: false
- match: { index.mappings: {} }

View File

@ -1,12 +1,19 @@
setup:
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_index1
- do:
indices.create:
include_type_name: false
index: test_index2
- do:
indices.create:
include_type_name: false
index: foo
@ -14,34 +21,33 @@ setup:
"put one mapping per index":
- do:
indices.put_mapping:
include_type_name: false
index: test_index1
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.put_mapping:
include_type_name: false
index: test_index2
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index1.mappings.properties.text.type: text}
- match: {test_index1.mappings.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.properties.text.type: text}
- match: {test_index2.mappings.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
@ -50,73 +56,73 @@ setup:
- do:
indices.put_mapping:
include_type_name: false
index: _all
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index1.mappings.properties.text.type: text}
- match: {test_index1.mappings.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.properties.text.type: text}
- match: {test_index2.mappings.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.properties.text.type: text}
- match: {foo.mappings.properties.text.analyzer: whitespace}
---
"put mapping in * index":
- do:
indices.put_mapping:
include_type_name: false
index: "*"
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index1.mappings.properties.text.type: text}
- match: {test_index1.mappings.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.properties.text.type: text}
- match: {test_index2.mappings.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.properties.text.type: text}
- match: {foo.mappings.properties.text.analyzer: whitespace}
---
"put mapping in prefix* index":
- do:
indices.put_mapping:
include_type_name: false
index: "test_index*"
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index1.mappings.properties.text.type: text}
- match: {test_index1.mappings.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.properties.text.type: text}
- match: {test_index2.mappings.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
@ -124,67 +130,34 @@ setup:
"put mapping in list of indices":
- do:
indices.put_mapping:
include_type_name: false
index: [test_index1, test_index2]
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index1.mappings.properties.text.type: text}
- match: {test_index1.mappings.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.properties.text.type: text}
- match: {test_index2.mappings.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
---
"put mapping with blank index":
- do:
indices.put_mapping:
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
---
"put mapping with missing type":
- do:
catch: param
indices.put_mapping: {}
---
"post a mapping with default analyzer twice":
- do:
indices.put_mapping:
include_type_name: false
index: test_index1
type: test_type
body:
test_type:
dynamic: false
properties:
text:
@ -193,18 +166,18 @@ setup:
- do:
indices.put_mapping:
include_type_name: false
index: test_index1
type: test_type
body:
test_type:
dynamic: false
properties:
text:
analyzer: default
type: text
dynamic: false
properties:
text:
analyzer: default
type: text
- do:
indices.get_mapping: {}
indices.get_mapping:
include_type_name: false
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.properties.text.type: text}

View File

@ -0,0 +1,210 @@
setup:
- do:
indices.create:
index: test_index1
- do:
indices.create:
index: test_index2
- do:
indices.create:
index: foo
---
"put one mapping per index":
- do:
indices.put_mapping:
index: test_index1
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.put_mapping:
index: test_index2
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
---
"put mapping in _all index":
- do:
indices.put_mapping:
index: _all
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
---
"put mapping in * index":
- do:
indices.put_mapping:
index: "*"
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
---
"put mapping in prefix* index":
- do:
indices.put_mapping:
index: "test_index*"
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
---
"put mapping in list of indices":
- do:
indices.put_mapping:
index: [test_index1, test_index2]
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: { foo.mappings: {} }
---
"put mapping with blank index":
- do:
indices.put_mapping:
type: test_type
body:
test_type:
properties:
text:
type: text
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}
- match: {test_index1.mappings.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.mappings.test_type.properties.text.type: text}
- match: {test_index2.mappings.test_type.properties.text.analyzer: whitespace}
- match: {foo.mappings.test_type.properties.text.type: text}
- match: {foo.mappings.test_type.properties.text.analyzer: whitespace}
---
"put mapping with missing type":
- do:
catch: param
indices.put_mapping: {}
---
"post a mapping with default analyzer twice":
- do:
indices.put_mapping:
index: test_index1
type: test_type
body:
test_type:
dynamic: false
properties:
text:
analyzer: default
type: text
- do:
indices.put_mapping:
index: test_index1
type: test_type
body:
test_type:
dynamic: false
properties:
text:
analyzer: default
type: text
- do:
indices.get_mapping: {}
- match: {test_index1.mappings.test_type.properties.text.type: text}

View File

@ -0,0 +1,46 @@
---
"No type returned":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: {}
- do:
indices.refresh: {}
- do:
search:
include_type_name: false
index: test_1
- length: { hits.hits: 1 }
- match: { hits.hits.0._index: "test_1" }
- is_false: "hits.hits.0._type"
- match: { hits.hits.0._id: "1" }
---
"Mixing include_type_name=false with explicit types":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: /illegal_argument_exception/
search:
index: index
type: type
include_type_name: false
- do:
catch: /illegal_argument_exception/
search:
index: index
type: _doc
include_type_name: false

View File

@ -1,10 +1,14 @@
---
"Partial document":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body:
foo: bar
@ -13,8 +17,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc:
@ -23,14 +27,14 @@
one: 3
- match: { _index: test_1 }
- match: { _type: test }
- is_false: "_type"
- match: { _id: "1" }
- match: { _version: 2 }
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _source.foo: baz }
@ -38,3 +42,12 @@
- match: { _source.nested.one: 3 }
- match: { _source.nested.two: 2 }
- do:
catch: /illegal_argument_exception/
update:
index: index
type: type
id: 1
include_type_name: false
body:
doc: { foo: baz }

View File

@ -1,8 +1,13 @@
---
"Update check shard header":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: foobar
body:
settings:
@ -15,22 +20,22 @@
- do:
index:
include_type_name: false
index: foobar
type: baz
id: 1
body: { foo: bar }
- do:
update:
include_type_name: false
index: foobar
type: baz
id: 1
body:
doc:
foo: baz
- match: { _index: foobar }
- match: { _type: baz }
- is_false: "_type"
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}

View File

@ -1,10 +1,14 @@
---
"Update result field":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
@ -15,8 +19,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
@ -27,8 +31,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
@ -40,8 +44,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: baz }

View File

@ -0,0 +1,40 @@
---
"Partial document":
- do:
index:
index: test_1
type: test
id: 1
body:
foo: bar
count: 1
nested: { one: 1, two: 2 }
- do:
update:
index: test_1
type: test
id: 1
body:
doc:
foo: baz
nested:
one: 3
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: "1" }
- match: { _version: 2 }
- do:
get:
index: test_1
type: test
id: 1
- match: { _source.foo: baz }
- match: { _source.count: 1 }
- match: { _source.nested.one: 3 }
- match: { _source.nested.two: 2 }

View File

@ -0,0 +1,39 @@
---
"Update check shard header":
- do:
indices.create:
index: foobar
body:
settings:
number_of_shards: "1"
number_of_replicas: "0"
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: foobar
type: baz
id: 1
body: { foo: bar }
- do:
update:
index: foobar
type: baz
id: 1
body:
doc:
foo: baz
- match: { _index: foobar }
- match: { _type: baz }
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}
- match: { _shards.successful: 1}
- match: { _shards.failed: 0}
- is_false: _shards.pending

View File

@ -0,0 +1,52 @@
---
"Update result field":
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
doc_as_upsert: true
- match: { _version: 1 }
- match: { result: created }
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
doc_as_upsert: true
- match: { _version: 1 }
- match: { result: noop }
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar }
doc_as_upsert: true
detect_noop: false
- match: { _version: 2 }
- match: { result: updated }
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
doc_as_upsert: true
detect_noop: true
- match: { _version: 3 }
- match: { result: updated }

View File

@ -1,10 +1,14 @@
---
"Doc upsert":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
@ -12,8 +16,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _source.foo: baz }
@ -22,8 +26,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
@ -31,8 +35,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _source.foo: bar }

View File

@ -0,0 +1,41 @@
---
"Doc upsert":
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
upsert: { foo: baz }
- do:
get:
index: test_1
type: test
id: 1
- match: { _source.foo: baz }
- is_false: _source.count
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
upsert: { foo: baz }
- do:
get:
index: test_1
type: test
id: 1
- match: { _source.foo: bar }
- match: { _source.count: 1 }

View File

@ -1,10 +1,14 @@
---
"Doc as upsert":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
@ -12,8 +16,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _source.foo: bar }
@ -22,8 +26,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { count: 2 }
@ -31,8 +35,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
- match: { _source.foo: bar }

View File

@ -0,0 +1,41 @@
---
"Doc as upsert":
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: bar, count: 1 }
doc_as_upsert: true
- do:
get:
index: test_1
type: test
id: 1
- match: { _source.foo: bar }
- match: { _source.count: 1 }
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { count: 2 }
doc_as_upsert: true
- do:
get:
index: test_1
type: test
id: 1
- match: { _source.foo: bar }
- match: { _source.count: 2 }

View File

@ -1,11 +1,15 @@
---
"Internal version":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: missing
update:
include_type_name: false
index: test_1
type: test
id: 1
version: 1
body:
@ -13,8 +17,8 @@
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
@ -22,8 +26,8 @@
- do:
catch: conflict
update:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
body:

View File

@ -0,0 +1,30 @@
---
"Internal version":
- do:
catch: missing
update:
index: test_1
type: test
id: 1
version: 1
body:
doc: { foo: baz }
- do:
index:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
- do:
catch: conflict
update:
index: test_1
type: test
id: 1
version: 2
body:
doc: { foo: baz }

View File

@ -1,11 +1,15 @@
---
"Not supported versions":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
catch: /Validation|Invalid/
update:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
version_type: external
@ -16,8 +20,8 @@
- do:
catch: /Validation|Invalid/
update:
include_type_name: false
index: test_1
type: test
id: 1
version: 2
version_type: external_gte

View File

@ -0,0 +1,27 @@
---
"Not supported versions":
- do:
catch: /Validation|Invalid/
update:
index: test_1
type: test
id: 1
version: 2
version_type: external
body:
doc: { foo: baz }
upsert: { foo: bar }
- do:
catch: /Validation|Invalid/
update:
index: test_1
type: test
id: 1
version: 2
version_type: external_gte
body:
doc: { foo: baz }
upsert: { foo: bar }

View File

@ -1,8 +1,13 @@
---
"Routing":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -17,8 +22,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
body:
@ -27,8 +32,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
stored_fields: _routing
@ -38,16 +43,16 @@
- do:
catch: missing
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
routing: 5
_source: foo

View File

@ -0,0 +1,58 @@
---
"Routing":
- do:
indices.create:
index: test_1
body:
settings:
index:
number_of_shards: 5
number_of_routing_shards: 5
number_of_replicas: 0
- do:
cluster.health:
wait_for_status: green
- do:
update:
index: test_1
type: test
id: 1
routing: 5
body:
doc: { foo: baz }
upsert: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
routing: 5
stored_fields: _routing
- match: { _routing: "5"}
- do:
catch: missing
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
- do:
update:
index: test_1
type: test
id: 1
routing: 5
_source: foo
body:
doc: { foo: baz }
- match: { get._source.foo: baz }

View File

@ -1,8 +1,13 @@
---
"Refresh":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
@ -11,8 +16,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
@ -20,6 +25,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -28,8 +34,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 2
refresh: true
body:
@ -39,6 +45,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 2 }}
@ -47,10 +54,15 @@
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: test_1
type: test
id: 1
refresh: true
body: { foo: bar }
@ -58,8 +70,8 @@
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
refresh: ""
body:
@ -68,6 +80,7 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { cat: dog }}
@ -76,10 +89,15 @@
---
"refresh=wait_for waits until changes are visible in search":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
index:
include_type_name: false
index: update_60_refresh_1
type: test
id: update_60_refresh_id1
body: { foo: bar }
refresh: true
@ -87,6 +105,7 @@
- do:
search:
include_type_name: false
index: update_60_refresh_1
body:
query: { term: { _id: update_60_refresh_id1 }}
@ -94,8 +113,8 @@
- do:
update:
include_type_name: false
index: update_60_refresh_1
type: test
id: update_60_refresh_id1
refresh: wait_for
body:
@ -104,6 +123,7 @@
- do:
search:
include_type_name: false
index: update_60_refresh_1
body:
query: { match: { test: asdf } }

View File

@ -0,0 +1,110 @@
---
"Refresh":
- do:
indices.create:
index: test_1
body:
settings:
index.refresh_interval: -1
number_of_replicas: 0
- do:
update:
index: test_1
type: test
id: 1
body:
doc: { foo: baz }
upsert: { foo: bar }
- do:
search:
index: test_1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
- do:
update:
index: test_1
type: test
id: 2
refresh: true
body:
doc: { foo: baz }
upsert: { foo: bar }
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { term: { _id: 2 }}
- match: { hits.total: 1 }
---
"When refresh url parameter is an empty string that means \"refresh immediately\"":
- do:
index:
index: test_1
type: test
id: 1
refresh: true
body: { foo: bar }
- is_true: forced_refresh
- do:
update:
index: test_1
type: test
id: 1
refresh: ""
body:
doc: {cat: dog}
- is_true: forced_refresh
- do:
search:
index: test_1
body:
query: { term: { cat: dog }}
- match: { hits.total: 1 }
---
"refresh=wait_for waits until changes are visible in search":
- do:
index:
index: update_60_refresh_1
type: test
id: update_60_refresh_id1
body: { foo: bar }
refresh: true
- is_true: forced_refresh
- do:
search:
index: update_60_refresh_1
body:
query: { term: { _id: update_60_refresh_id1 }}
- match: { hits.total: 1 }
- do:
update:
index: update_60_refresh_1
type: test
id: update_60_refresh_id1
refresh: wait_for
body:
doc: { test: asdf }
- is_false: forced_refresh
- do:
search:
index: update_60_refresh_1
body:
query: { match: { test: asdf } }
- match: { hits.total: 1 }

View File

@ -1,10 +1,14 @@
---
"Source filtering":
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
_source: [foo, bar]
body:

View File

@ -0,0 +1,19 @@
---
"Source filtering":
- do:
update:
index: test_1
type: test
id: 1
_source: [foo, bar]
body:
doc: { foo: baz }
upsert: { foo: bar }
- match: { get._source.foo: bar }
- is_false: get._source.bar
# TODO:
#
# - Add _routing

View File

@ -7,12 +7,13 @@
- do:
indices.create:
include_type_name: false
index: test_1
- do:
update:
include_type_name: false
index: test_1
type: test
id: 1
parent: 5
fields: [ _routing ]
@ -24,8 +25,8 @@
- do:
get:
include_type_name: false
index: test_1
type: test
id: 1
parent: 5
stored_fields: [ _routing ]

View File

@ -0,0 +1,33 @@
---
"Metadata Fields":
- skip:
version: "all"
reason: "Update doesn't return metadata fields, waiting for #3259"
- do:
indices.create:
index: test_1
- do:
update:
index: test_1
type: test
id: 1
parent: 5
fields: [ _routing ]
body:
doc: { foo: baz }
upsert: { foo: bar }
- match: { get._routing: "5" }
- do:
get:
index: test_1
type: test
id: 1
parent: 5
stored_fields: [ _routing ]

View File

@ -21,6 +21,7 @@ package org.elasticsearch.test.rest.yaml.section;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentParseException;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.yaml.YamlXContent;
@ -73,9 +74,10 @@ public class ClientYamlTestSuite {
}
public static ClientYamlTestSuite parse(String api, String suiteName, XContentParser parser) throws IOException {
parser.nextToken();
assert parser.currentToken() == XContentParser.Token.START_OBJECT : "expected token to be START_OBJECT but was "
+ parser.currentToken();
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
throw new XContentParseException(parser.getTokenLocation(),
"expected token to be START_OBJECT but was " + parser.currentToken());
}
ClientYamlTestSuite restTestSuite = new ClientYamlTestSuite(api, suiteName);