Transform string fields to text/keyword
This guide explains how Migration Assistant automatically handles the deprecated string
field type during migration from earlier Elasticsearch versions.
Overview
The string
field type was the primary text field type in early versions of Elasticsearch but was deprecated in Elasticsearch 5.x and completely removed in Elasticsearch 6.0. In Elasticsearch 5.x, it remained available in backward compatibility mode only.
When migrating from Elasticsearch 1.x through 5.x to later versions, Migration Assistant automatically converts string
field types to their modern equivalents: text
for analyzed fields and keyword
for non-analyzed fields.
To determine whether an Elasticsearch cluster uses string
field types, make a call to your source cluster’s GET /_mapping
API. In the migration console, run console clusters curl source_cluster "/_mapping"
. If you see "type":"string"
, then this transformation is applicable and these fields will be automatically transformed during migration.
Compatibility
The string
to text
/keyword
field type transformation applies to:
- Source clusters: Elasticsearch 1.x–5.x
- Target clusters: Elasticsearch 5.x+ or OpenSearch 1.x+
- Automatic conversion: No configuration required during metadata migrations.
Automatic conversion logic
Migration Assistant determines whether to convert a string
field to text
or keyword
based on the field’s index
property.
Conversion to keyword
Fields are converted to keyword
when:
index: "not_analyzed"
index: "no"
index: false
Conversion to text
Fields are converted to text
when:
index: "analyzed"
index
is undefined
Property cleanup
During conversion, Migration Assistant also cleans up properties that are incompatible with the target field type.
For keyword
fields, the following properties are removed:
analyzer
search_analyzer
position_increment_gap
term_vector
fielddata
For text
fields, the following properties are removed:
doc_values
null_value
(if present)
Additionally, legacy index
values are normalized:
index: "analyzed"
andindex: "not_analyzed"
are removed (Elasticsearch 5.x default istrue
).index: "no"
becomesindex: false
.
Migration output
During the migration process, you’ll see this transformation in the output:
Transformations:
string to text/keyword:
Convert field type string to text/keyword based on field data mappings
Transformation behavior
Source field type | Target field type |
---|---|
|
|
|
|
Behavior differences
Migration Assistant automatically converts all string
fields during metadata migration. No additional configuration is required.
Mixed field types
If your source cluster already contains a mix of string
, text
, and keyword
fields (common in Elasticsearch 5.x with restored Elasticsearch 2.x indexes), only the string
fields will be converted. Existing text
and keyword
fields remain unchanged.
Query and aggregation impacts
After migration, be aware of these key differences:
- Term queries work differently on
text
(analyzed) andkeyword
(exact match) fields. - Aggregations:
text
fields cannot be used for aggregations unlessfielddata
is enabled;keyword
fields are aggregation ready. - Sorting:
text
fields cannot be used for sorting by default;keyword
fields support sorting. - Case sensitivity:
keyword
fields are case sensitive;text
fields depend on the analyzer.
Application compatibility
Review your application code for:
- Queries that expect the old
string
field behavior. - Aggregations or sorting on fields now converted to
text
. - Case-sensitive searches on fields now using
keyword
.
For fields requiring both analyzed and exact-match capabilities, consider using multi-fields with both text
and keyword
mappings after migration.
Troubleshooting
If you encounter issues with string field conversion:
-
Verify source version – Ensure your source cluster is running Elasticsearch 1.x through 5.x.
- Check migration logs – Review the detailed migration logs for any warnings or errors:
tail /shared-logs-output/migration-console-default/*/metadata/*.log
- Validate mappings – After migration, verify that the field types have been correctly converted:
GET /your-index/_mapping
- Review field usage – Ensure that your application queries are compatible with the new field types. Queries that worked with
string
fields should continue to work withtext
andkeyword
fields, but some advanced features may behave differently.
Related documentation
- Transform field types documentation – Configure custom field type transformations.
- keyword field type documentation – Learn about keyword field type.
- text field type documentation – Learn about text field type.