Remove include_type_name from the relevant APIs. (#35192)

We've decided that the bulk, delete, get, index, update, and search APIs should not
contain this request parameter, and we will instead accept both typed and typeless calls.
This commit is contained in:
Julie Tibshirani 2018-11-06 14:33:48 -08:00 committed by GitHub
parent 6f6b265166
commit ec53288fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 101 additions and 430 deletions

View File

@ -495,12 +495,12 @@ The above call returns
[float]
==== Document APIs
Index APIs must be call with the `{index}/_doc` path for automatic generation of
Index APIs must be called with the `{index}/_doc` path for automatic generation of
the `_id` and `{index}/_doc/{id}` with explicit ids.
[source,js]
--------------------------------------------------
PUT index/_doc/1?include_type_name=false
PUT index/_doc/1
{
"foo": "bar"
}
@ -512,6 +512,7 @@ PUT index/_doc/1?include_type_name=false
{
"_index": "index", <1>
"_id": "1",
"_type": "_doc",
"_version": 1,
"result": "created",
"_shards": {
@ -526,6 +527,6 @@ PUT index/_doc/1?include_type_name=false
// TESTRESPONSE
<1> The response does not include a `_type`.
Likewise the <<docs-index_,GET>>, <<docs-delete,`DELETE`>>,
<<docs-update,`_update`>> and <<search,`_search`>> APIs do not return a `_type`
key in the response when `include_type_name` is set to `false`.
The <<docs-index_,GET>>, <<docs-delete,`DELETE`>>, <<docs-update,`_update`>> and <<search,`_search`>> APIs
will continue to return a `_type` key in the response in 7.0, but it is considered deprecated and will be
removed in 8.0.

View File

@ -16,10 +16,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"wait_for_active_shards": {
"type" : "string",
"description" : "Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)"

View File

@ -22,10 +22,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"wait_for_active_shards": {
"type" : "string",
"description" : "Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)"

View File

@ -22,10 +22,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"stored_fields": {
"type": "list",
"description" : "A comma-separated list of stored fields to return in the response"

View File

@ -21,10 +21,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"wait_for_active_shards": {
"type" : "string",
"description" : "Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)"

View File

@ -16,10 +16,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"analyzer": {
"type" : "string",
"description" : "The analyzer to use for the query string"

View File

@ -22,10 +22,6 @@
}
},
"params": {
"include_type_name": {
"type" : "string",
"description" : "Whether to add the type name to the response"
},
"wait_for_active_shards": {
"type": "string",
"description": "Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)"

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- index:
@ -32,11 +31,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- index:
@ -69,14 +67,13 @@
- skip:
version: " - 6.99.99"
features: headers
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 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", "_id": "test_id"}}
{"f1": "v1", "f2": 42}

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body:
- '{"index": {"_index": "test_index", "_id": "test_id"}}'

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body: |
{"index": {"_index": "test_index", "_id": "test_id"}}

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
refresh: true
index: test_index
id: test_id_1
@ -15,7 +13,6 @@
- do:
index:
include_type_name: false
refresh: true
index: test_index
id: test_id_2
@ -23,7 +20,6 @@
- do:
index:
include_type_name: false
refresh: true
index: test_index
id: test_id_3
@ -32,7 +28,6 @@
- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": true } }
@ -45,7 +40,6 @@
- do:
bulk:
include_type_name: false
index: test_index
_source: true
body: |
@ -56,7 +50,6 @@
- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": {"includes": "bar"} } }
@ -71,7 +64,6 @@
- do:
bulk:
include_type_name: false
index: test_index
_source_includes: foo
body: |

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: true
body: |
{"index": {"_index": "bulk_50_refresh_1", "_id": "bulk_50_refresh_id1"}}
@ -25,11 +23,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: ""
body: |
{"index": {"_index": "bulk_50_refresh_2", "_id": "bulk_50_refresh_id3"}}
@ -48,11 +44,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
bulk:
include_type_name: false
refresh: wait_for
body: |
{"index": {"_index": "bulk_50_refresh_3", "_id": "bulk_50_refresh_id5"}}

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -16,16 +15,7 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
- match: { _version: 2 }
- do:
catch: /illegal_argument_exception/
delete:
include_type_name: false
index: index
type: type
id: 1

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -20,19 +20,17 @@
- do:
index:
include_type_name: false
index: foobar
id: 1
body: { foo: bar }
- do:
delete:
include_type_name: false
index: foobar
id: 1
- match: { _index: foobar }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}

View File

@ -3,18 +3,16 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
- do:
delete:
include_type_name: false
index: test_1
id: 1
@ -23,7 +21,6 @@
- do:
catch: missing
delete:
include_type_name: false
index: test_1
id: 1

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -17,14 +16,12 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
id: 1
version: 2
- do:
delete:
include_type_name: false
index: test_1
id: 1
version: 1

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -19,7 +18,6 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
id: 1
version_type: external
@ -27,7 +25,6 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
version_type: external

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -19,7 +18,6 @@
- do:
catch: conflict
delete:
include_type_name: false
index: test_1
id: 1
version_type: external_gte
@ -27,7 +25,6 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
version_type: external_gte
@ -37,7 +34,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -48,7 +44,6 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
version_type: external_gte

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -14,7 +14,6 @@
number_of_shards: 5
- do:
index:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -23,14 +22,12 @@
- do:
catch: missing
delete:
include_type_name: false
index: test_1
id: 1
routing: 4
- do:
delete:
include_type_name: false
index: test_1
id: 1
routing: 5

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -21,7 +21,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -32,7 +31,6 @@
# them to be different for this test to pass
- do:
index:
include_type_name: false
index: test_1
id: 3
body: { foo: bar }
@ -41,7 +39,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -50,13 +47,11 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -65,7 +60,6 @@
- do:
delete:
include_type_name: false
index: test_1
id: 3
refresh: true
@ -76,7 +70,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { terms: { _id: [1,3] }}
@ -88,11 +81,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -101,7 +93,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -109,14 +100,12 @@
- do:
delete:
include_type_name: false
index: test_1
id: 1
refresh: ""
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -127,11 +116,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: delete_50_refresh_1
id: delete_50_refresh_id1
body: { foo: bar }
@ -140,7 +128,6 @@
- do:
search:
include_type_name: false
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}
@ -148,7 +135,6 @@
- do:
delete:
include_type_name: false
index: delete_50_refresh_1
id: delete_50_refresh_id1
refresh: wait_for
@ -156,7 +142,6 @@
- do:
search:
include_type_name: false
index: delete_50_refresh_1
body:
query: { term: { _id: delete_50_refresh_id1 }}

View File

@ -3,12 +3,11 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
catch: missing
delete:
include_type_name: false
index: test_1
id: 1
@ -17,11 +16,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
delete:
include_type_name: false
index: test_1
id: 1
ignore: 404

View File

@ -3,30 +3,20 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 中文
body: { "foo": "Hello: 中文" }
- do:
get:
include_type_name: false
index: test_1
id: 中文
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: 中文 }
- match: { _source: { foo: "Hello: 中文" } }
- do:
catch: /illegal_argument_exception/
get:
index: index
type: type
id: 1
include_type_name: false

View File

@ -3,23 +3,20 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { "foo": "bar" }
- do:
get:
include_type_name: false
index: test_1
id: 1
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: '1' }
- match: { _source: { foo: "bar" } }

View File

@ -3,8 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -21,26 +20,23 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { "foo": "bar", "count": 1 }
- do:
get:
include_type_name: false
index: test_1
id: 1
stored_fields: foo
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: '1' }
- match: { fields.foo: [bar] }
- is_false: _source
- do:
get:
include_type_name: false
index: test_1
id: 1
stored_fields: [foo, count]
@ -51,7 +47,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
stored_fields: [foo, count, _source]

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -22,7 +22,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -30,7 +29,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -42,7 +40,6 @@
- do:
catch: missing
get:
include_type_name: false
index: test_1
id: 1

View File

@ -3,11 +3,9 @@
- skip:
features: ["headers", "yaml"]
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { "body": "foo" }
@ -16,12 +14,11 @@
headers:
Accept: application/yaml
get:
include_type_name: false
index: test_1
id: 1
- match: {_index: "test_1"}
- is_false: "_type"
- match: { _type: _doc }
- match: {_id: "1"}
- match: {_version: 1}
- match: {found: true}

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -21,7 +21,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -29,14 +28,12 @@
- do:
catch: missing
get:
include_type_name: false
index: test_1
id: 1
realtime: false
- do:
get:
include_type_name: false
index: test_1
id: 1
realtime: true
@ -45,7 +42,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
realtime: false

View File

@ -3,8 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -18,40 +17,39 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
- do:
get: { include_type_name: false, index: test_1, id: 1, _source: false }
get: { index: test_1, id: 1, _source: false }
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1" }
- is_false: _source
- do:
get: { include_type_name: false, index: test_1, id: 1, _source: true }
get: { index: test_1, id: 1, _source: true }
- match: { _source.include.field1: v1 }
- do:
get: { include_type_name: false, index: test_1, id: 1, _source: include.field1 }
get: { index: test_1, id: 1, _source: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { include_type_name: false, index: test_1, id: 1, _source_includes: include.field1 }
get: { index: test_1, id: 1, _source_includes: include.field1 }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- do:
get: { include_type_name: false, index: test_1, id: 1, _source_includes: "include.field1,include.field2" }
get: { index: test_1, id: 1, _source_includes: "include.field1,include.field2" }
- match: { _source.include.field1: v1 }
- match: { _source.include.field2: v2 }
- is_false: _source.count
- do:
get: { include_type_name: false, index: test_1, id: 1, _source_includes: include, _source_excludes: "*.field2" }
get: { index: test_1, id: 1, _source_includes: include, _source_excludes: "*.field2" }
- match: { _source.include.field1: v1 }
- is_false: _source.include.field2
- is_false: _source.count
@ -59,14 +57,13 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
stored_fields: count
_source: true
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1" }
- match: { fields.count: [1] }
- match: { _source.include.field1: v1 }

View File

@ -3,12 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
catch: missing
get:
include_type_name: false
index: test_1
id: 1
@ -17,11 +15,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
get:
include_type_name: false
index: test_1
id: 1
ignore: 404

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -15,7 +14,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -23,7 +21,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
version: 2
@ -32,14 +29,12 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
id: 1
version: 1
- do:
get:
include_type_name: false
index: test_1
id: 1
version: 2
@ -49,7 +44,6 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
id: 1
version: 10
@ -58,7 +52,6 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
id: 1
version: 1
@ -66,7 +59,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
version: 2
@ -76,7 +68,6 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
id: 1
version: 10
@ -85,7 +76,6 @@
- do:
catch: conflict
get:
include_type_name: false
index: test_1
id: 1
version: 1

View File

@ -3,28 +3,26 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test-weird-index-中文
id: 1
body: { foo: bar }
- match: { _index: test-weird-index-中文 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}
- do:
get:
include_type_name: false
index: test-weird-index-中文
id: 1
- match: { _index: test-weird-index-中文 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}
@ -32,16 +30,6 @@
- do:
catch: bad_request
index:
include_type_name: false
index: idx
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

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_index
id: 1
body: { foo: bar }
@ -16,7 +14,6 @@
- do:
index:
include_type_name: false
index: test_index
id: 1
body: { foo: bar }

View File

@ -3,36 +3,26 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
body: { foo: bar }
- is_true: _id
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
include_type_name: false
index: test_1
id: '$id'
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- 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

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
op_type: create
@ -16,7 +15,6 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
id: 1
op_type: create
@ -24,7 +22,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
op_type: index

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -15,7 +14,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -24,14 +22,12 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
version: 1
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -18,7 +17,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -30,7 +28,6 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -40,7 +37,6 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -49,7 +45,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }

View File

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -18,7 +17,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -30,7 +28,6 @@
- do:
catch: conflict
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
@ -39,7 +36,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar2 }
@ -50,7 +46,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar2 }

View File

@ -3,8 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -22,7 +21,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -30,7 +28,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -42,7 +39,6 @@
- do:
catch: missing
get:
include_type_name: false
index: test_1
id: 1

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -16,14 +16,12 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body: { foo: bar }
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -32,7 +30,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 2
refresh: true
@ -41,7 +38,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 2 }}
@ -53,11 +49,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
refresh: ""
@ -66,7 +61,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -78,11 +72,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: index_60_refresh_1
id: index_60_refresh_id1
body: { foo: bar }
@ -91,7 +84,6 @@
- do:
search:
include_type_name: false
index: index_60_refresh_1
body:
query: { term: { _id: index_60_refresh_id1 }}

View File

@ -3,8 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -25,8 +24,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -46,8 +44,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -61,8 +58,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -80,8 +76,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false

View File

@ -2,8 +2,7 @@
setup:
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false

View File

@ -3,8 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -63,8 +62,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false
@ -84,8 +82,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
index: index
@ -101,4 +98,3 @@
properties:
bar:
type: float

View File

@ -1,8 +1,7 @@
setup:
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
include_type_name: false

View File

@ -1,46 +0,0 @@
---
"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

@ -3,11 +3,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
body:
@ -17,7 +16,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -27,13 +25,12 @@
one: 3
- match: { _index: test_1 }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1" }
- match: { _version: 2 }
- do:
get:
include_type_name: false
index: test_1
id: 1
@ -41,13 +38,3 @@
- match: { _source.count: 1 }
- 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

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -20,14 +20,12 @@
- do:
index:
include_type_name: false
index: foobar
id: 1
body: { foo: bar }
- do:
update:
include_type_name: false
index: foobar
id: 1
body:
@ -35,7 +33,7 @@
foo: baz
- match: { _index: foobar }
- is_false: "_type"
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 2}
- match: { _shards.total: 1}

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -19,7 +17,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -31,7 +28,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -44,7 +40,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -16,7 +14,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
@ -26,7 +23,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -35,7 +31,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -16,7 +14,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
@ -26,7 +23,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -35,7 +31,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1

View File

@ -3,12 +3,11 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
catch: missing
update:
include_type_name: false
index: test_1
id: 1
version: 1
@ -17,7 +16,6 @@
- do:
index:
include_type_name: false
index: test_1
id: 1
body:
@ -26,7 +24,6 @@
- do:
catch: conflict
update:
include_type_name: false
index: test_1
id: 1
version: 2

View File

@ -3,12 +3,11 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
catch: /Validation|Invalid/
update:
include_type_name: false
index: test_1
id: 1
version: 2
@ -20,7 +19,6 @@
- do:
catch: /Validation|Invalid/
update:
include_type_name: false
index: test_1
id: 1
version: 2

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -22,7 +22,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -32,7 +31,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
routing: 5
@ -43,7 +41,6 @@
- do:
catch: missing
update:
include_type_name: false
index: test_1
id: 1
body:
@ -51,7 +48,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
routing: 5

View File

@ -3,7 +3,7 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
indices.create:
@ -16,7 +16,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
body:
@ -25,7 +24,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 1 }}
@ -34,7 +32,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 2
refresh: true
@ -45,7 +42,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { _id: 2 }}
@ -57,11 +53,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: test_1
id: 1
refresh: true
@ -70,7 +65,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
refresh: ""
@ -80,7 +74,6 @@
- do:
search:
include_type_name: false
index: test_1
body:
query: { term: { cat: dog }}
@ -92,11 +85,10 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
index:
include_type_name: false
index: update_60_refresh_1
id: update_60_refresh_id1
body: { foo: bar }
@ -105,7 +97,6 @@
- do:
search:
include_type_name: false
index: update_60_refresh_1
body:
query: { term: { _id: update_60_refresh_id1 }}
@ -113,7 +104,6 @@
- do:
update:
include_type_name: false
index: update_60_refresh_1
id: update_60_refresh_id1
refresh: wait_for
@ -123,7 +113,6 @@
- do:
search:
include_type_name: false
index: update_60_refresh_1
body:
query: { match: { test: asdf } }

View File

@ -3,11 +3,9 @@
- skip:
version: " - 6.99.99"
reason: include_type_name was introduced in 7.0.0
reason: types are required in requests before 7.0.0
- do:
update:
include_type_name: false
index: test_1
id: 1
_source: [foo, bar]

View File

@ -12,7 +12,6 @@
- do:
update:
include_type_name: false
index: test_1
id: 1
parent: 5
@ -25,7 +24,6 @@
- do:
get:
include_type_name: false
index: test_1
id: 1
parent: 5

View File

@ -296,9 +296,7 @@ public abstract class DocWriteResponse extends ReplicationResponse implements Wr
public XContentBuilder innerToXContent(XContentBuilder builder, Params params) throws IOException {
ReplicationResponse.ShardInfo shardInfo = getShardInfo();
builder.field(_INDEX, shardId.getIndexName());
if (params.paramAsBoolean("include_type_name", true)) {
builder.field(_TYPE, type);
}
builder.field(_TYPE, type);
builder.field(_ID, id)
.field(_VERSION, version)
.field(RESULT, getResult().getLowercase());

View File

@ -256,9 +256,7 @@ public class GetResult implements Streamable, Iterable<DocumentField>, ToXConten
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(_INDEX, index);
if (params.paramAsBoolean("include_type_name", true)) {
builder.field(_TYPE, type);
}
builder.field(_TYPE, type);
builder.field(_ID, id);
if (isExists()) {
if (version != -1) {

View File

@ -73,11 +73,6 @@ public class RestBulkAction extends BaseRestHandler {
BulkRequest bulkRequest = Requests.bulkRequest();
String defaultIndex = request.param("index");
String defaultType = request.param("type");
final boolean includeTypeName = request.paramAsBoolean("include_type_name", true);
if (includeTypeName == false && defaultType != null) {
throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the bulx APIs with the " +
"[_bulk] and [{index}/_bulk] endpoints.");
}
if (defaultType == null) {
defaultType = MapperService.SINGLE_MAPPING_NAME;
}

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
@ -48,13 +47,9 @@ public class RestDeleteAction extends BaseRestHandler {
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final boolean includeTypeName = request.paramAsBoolean("include_type_name", true);
final String type = request.param("type");
if (includeTypeName == false && MapperService.SINGLE_MAPPING_NAME.equals(type) == false) {
throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the delete API with the " +
"[{index}/_doc/{id}] endpoints.");
}
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), type, request.param("id"));
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"),
request.param("type"),
request.param("id"));
deleteRequest.routing(request.param("routing"));
deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT));
deleteRequest.setRefreshPolicy(request.param("refresh"));

View File

@ -25,7 +25,6 @@ import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
@ -56,13 +55,9 @@ public class RestGetAction extends BaseRestHandler {
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final boolean includeTypeName = request.paramAsBoolean("include_type_name", true);
final String type = request.param("type");
if (includeTypeName == false && MapperService.SINGLE_MAPPING_NAME.equals(type) == false) {
throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the get APIs with the " +
"[{index}/_doc/{id}] endpoint.");
}
final GetRequest getRequest = new GetRequest(request.param("index"), type, request.param("id"));
final GetRequest getRequest = new GetRequest(request.param("index"),
request.param("type"),
request.param("id"));
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
getRequest.routing(request.param("routing"));
getRequest.preference(request.param("preference"));

View File

@ -25,7 +25,6 @@ import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
@ -51,13 +50,9 @@ public class RestUpdateAction extends BaseRestHandler {
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final boolean includeTypeName = request.paramAsBoolean("include_type_name", true);
final String type = request.param("type");
if (includeTypeName == false && MapperService.SINGLE_MAPPING_NAME.equals(type) == false) {
throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the update API with the " +
"[{index}/_doc/{id}/_update] endpoint.");
}
UpdateRequest updateRequest = new UpdateRequest(request.param("index"), type, request.param("id"));
UpdateRequest updateRequest = new UpdateRequest(request.param("index"),
request.param("type"),
request.param("id"));
updateRequest.routing(request.param("routing"));
updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout()));
updateRequest.setRefreshPolicy(request.param("refresh"));

View File

@ -150,13 +150,8 @@ public class RestSearchAction extends BaseRestHandler {
searchRequest.scroll(new Scroll(parseTimeValue(scroll, null, "scroll")));
}
final boolean includeTypeName = request.paramAsBoolean("include_type_name", true);
String types = request.param("type");
if (types != null) {
if (includeTypeName == false) {
throw new IllegalArgumentException("You may only use the [include_type_name=false] option with the search API with the " +
"[{index}/_search] endpoint.");
}
deprecationLogger.deprecated("The {index}/{type}/_search endpoint is deprecated, use {index}/_search instead");
}
searchRequest.types(Strings.splitStringByCommaToArray(types));

View File

@ -429,7 +429,7 @@ public final class SearchHit implements Streamable, ToXContentObject, Iterable<D
if (index != null) {
builder.field(Fields._INDEX, RemoteClusterAware.buildRemoteIndexName(clusterAlias, index));
}
if (type != null && params.paramAsBoolean("include_type_name", true)) {
if (type != null) {
builder.field(Fields._TYPE, type);
}
if (id != null) {