Reindex from 5.5 to 6.2 with different mapping

Hello, we're in the middle of upgrading our Elastic Stack from 5.5 to 6.2.4. I know the multi-type is already deprecated in version 6, so when we created the indices, we specify that the type of each index is "doc". The thing is, I cannot reindex from 5.5 because the type is different from source index to destination index. How can I resolve this? Is it possible to update the type in version 5.5 before reindexing?

Can you elaborate a little more on this, what do you mean by different?

I'm going to guess that you may want to use a script for the _reindex to change/update the type. https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

For example:

DELETE old
DELETE new
PUT old/custom_type/1
{
  "foo" : "bar"
}
GET old/custom_type/1
POST _reindex
{
  "source": {
    "index": "old",
    "type": "custom_type"
  },
  "dest": {
    "index": "new"
  },
   "script": {
    "source": "ctx._type = '_doc'",
    "lang": "painless"
  }
}
GET new/_doc/1

You can also achieve the same outcome by specifying an ingest node pipeline for the re-index and having that pipeline set the _type https://www.elastic.co/guide/en/elasticsearch/reference/current/accessing-data-in-pipelines.html

2 Likes

Thank you! This solution works for me :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.