After upgrading Elasticsearch from 5.3 to 5.6, do I need to reindex for schema updates

Hello,

I recently upgraded my Elasticsearch cluster from version 5.3 to 5.6. I’m now updating my schema to address deprecations introduced in 5.6. Below is the diff of the schema updates I intend to make:

{
  "properties": {
    "media_name": {
-     "type": "string",
+     "type": "text",
      "index": "analyzed"
    },
    "media_domain": {
-     "type": "string",
+     "type": "keyword",
-     "index": "not_analyzed",
      "doc_values": true
    },
    "writers": {
-     "type": "string",
+     "type": "keyword",
-     "index": "not_analyzed",
      "doc_values": true
    },
    "metadata__twitter__id_str": {
      "type": "text",
-     "index": "not_analyzed"
+     "index": false
    },
    "metadata__twitter__user__id_str": {
      "type": "text",
-     "index": "not_analyzed"
+     "index": false
    }
  }
}

I’m applying these updates using a PUT request to the _mapping endpoint. For example:

curl -X PUT "http://127.0.0.1:9200/my_index/_mapping/my_type" -H "Content-Type: application/json" -d'
{
  "properties": {
    ...
  }
}'

The response from Elasticsearch is "acknowledged": true, and the updated mappings are visible when I check the index.

My Questions:

  1. Are these schema updates (e.g., changing string to text or keyword, updating index settings) fully applied without needing to reindex the data?
  2. Will previously indexed data remain valid and queryable under the updated field definitions?
  3. For this specific upgrade scenario, do I need to create a new index and reindex my data to ensure compatibility and query consistency?

I’d appreciate guidance on whether reindexing is mandatory in this case or if the changes will work as intended without it.

Thank you for your help!

Hello and welcome,

Version 5.6 is ancient, it is complicated to provide any help, personally I do not remember any particularities of version 5.X anymore.

No, mapping changes are never applied to existing index in any version.

Probably yes, I never used string data type, but since this is a deprecation I do not expect for the behavior of queries to change.

I don't think so, but for new indices I would recommend to use the correct mapping, not one that was deprecated.

As I mentioned, version 5.X is pretty old and should not be used any more, it may be pretty hard for you to get any help.

If you can I recommend you start to planning to see if you can migrate to version 8.X.

1 Like

Hello @leandrojmp, thank you for your response!

If you can I recommend you start to planning to see if you can migrate to version 8.X.

I wish I could! However, I’m dealing with some significant constraints from my company:

  • No cluster downtime is allowed.
  • We’re unable to create a new cluster in 7.17 (or 8.x) to replicate new data and migrate historical data due to the need to maintain the 5.3 cluster. Additionally, the large volume of data makes the costs unmanageable.

Given these restrictions, my plan for upgrading to a more current version (at least an LTS) is to leverage the rolling update process and perform three incremental migrations:

  1. 5.3 → 5.6
  2. 5.6 → 6.8
  3. 6.8 → 7.17

Probably yes, I never used string data type, but since this is a deprecation I do not expect for the behavior of queries to change.

That’s good to know! I’ll update my schema to address the deprecation. From what I understand, the updated schema should still work in version 5.6. Then, after the rolling update from 5.6 to 6.8, I’ll need to reindex the cluster. Does that sound correct?

I’ve been referencing this page for details (in case it helps others who might face a similar situation in the future).

Thanks again for your help!

Yeah, this will not be smooth, there a lot of changes between those versions and a lot of things may break, too many details to check.

For example, in version 6 types were deprecated and removed in version 7, if you are using it you will need to change how you write your indices.

Also, Elasticsearch can only read indices created on the current and previous version, Elasticsearch 7 can not read indices created in version 5, so you will probably need to reindex all or at least some of your data.

The way you configure your cluster also changed a lot, depending on how it is configured you may need a full cluster restart.