[[string]]
=== String datatype

The `string` field is unsupported for indexes created in 5.x in favor of the
`text` and `keyword` fields. Attempting to create a string field in an index
created in 5.x will cause Elasticsearch to attempt to upgrade the `string` into
the appropriate `text` or `keyword` field. It will return an HTTP `Warning`
header telling you that `string` is deprecated. This upgrade process isn't
always perfect because there are some combinations of features that are
supported by `string` but not `text` or `keyword`. For that reason it is better
to use `text` or `keyword`.

Indexes imported from 2.x *only* support `string` and not `text` or `keyword`.
To ease the migration from 2.x Elasticsearch will downgrade `text` and `keyword`
mappings applied to indexes imported from 2.x into `string`. While long lived
indexes will eventually need to be recreated against 5.x before eventually
upgrading to 6.x, this downgrading smooths the process before you find time for
it.
