Skip to content

Commit

Permalink
Remove include_type_name from the relevant APIs. (elastic#35192)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jtibshirani authored and pgomulka committed Nov 13, 2018
1 parent dda9766 commit 8072a49
Show file tree
Hide file tree
Showing 63 changed files with 101 additions and 430 deletions.
11 changes: 6 additions & 5 deletions docs/reference/mapping/removal_of_types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -512,6 +512,7 @@ PUT index/_doc/1?include_type_name=false
{
"_index": "index", <1>
"_id": "1",
"_type": "_doc",
"_version": 1,
"result": "created",
"_shards": {
Expand All @@ -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.
4 changes: 0 additions & 4 deletions rest-api-spec/src/main/resources/rest-api-spec/api/bulk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
4 changes: 0 additions & 4 deletions rest-api-spec/src/main/resources/rest-api-spec/api/get.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions rest-api-spec/src/main/resources/rest-api-spec/api/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@

- 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
body: { "foo": "bar", "bar": "foo" }

- do:
index:
include_type_name: false
refresh: true
index: test_index
id: test_id_2
body: { "foo": "qux", "bar": "pux" }

- do:
index:
include_type_name: false
refresh: true
index: test_index
id: test_id_3
Expand All @@ -32,7 +28,6 @@

- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": true } }
Expand All @@ -45,7 +40,6 @@

- do:
bulk:
include_type_name: false
index: test_index
_source: true
body: |
Expand All @@ -56,7 +50,6 @@

- do:
bulk:
include_type_name: false
refresh: true
body: |
{ "update": { "_index": "test_index", "_id": "test_id_1", "_source": {"includes": "bar"} } }
Expand All @@ -71,7 +64,6 @@

- do:
bulk:
include_type_name: false
index: test_index
_source_includes: foo
body: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand All @@ -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"}}
Expand All @@ -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"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -23,7 +21,6 @@
- do:
catch: missing
delete:
include_type_name: false
index: test_1
id: 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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
Expand Down
Loading

0 comments on commit 8072a49

Please sign in to comment.