Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions docs/reference/mapping/removal_of_types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,108 @@ POST _reindex
----
// NOTCONSOLE

[float]
=== Use `include_type_name=false` to prepare for upgrade to 8.0

Index creation, mappings and document APIs support the `include_type_name`
option. When set to `false`, this option enables the behavior that will become
default in 8.0 when types are removed. See some examples of interactions with
Elasticsearch with this option turned off:

[float]
==== Index creation

[source,js]
--------------------------------------------------
PUT index?include_type_name=false
{
"mappings": {
"properties": { <1>
"foo": {
"type": "keyword"
}
}
}
}
--------------------------------------------------
// CONSOLE
<1> Mappings are included directly under the `mappings` key, without a type name.

[float]
==== PUT and GET mappings

[source,js]
--------------------------------------------------
PUT index

PUT index/_mappings?include_type_name=false
{
"properties": { <1>
"foo": {
"type": "keyword"
}
}
}

GET index/_mappings?include_type_name=false
--------------------------------------------------
// CONSOLE
<1> Mappings are included directly under the `mappings` key, without a type name.


The above call returns

[source,js]
--------------------------------------------------
{
"index": {
"mappings": {
"properties": { <1>
"foo": {
"type": "keyword"
}
}
}
}
}
--------------------------------------------------
// TESTRESPONSE
<1> Mappings are included directly under the `mappings` key, without a type name.

[float]
==== Document APIs

Index APIs must be call 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
{
"foo": "bar"
}
--------------------------------------------------
// CONSOLE

[source,js]
--------------------------------------------------
{
"_index": "index", <1>
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
--------------------------------------------------
// 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`.