Reindex behavior with dynamic mapping false

Hey,
I am trying to implement some kind of migration for mapping changes. So my problem is I want to use reindex if for some reason my new mapping doesn't work with my current data (e.g. types changed). If a field has been removed I do the following:

  • create a new index with the new mapping (where the removed field is not included)
  • reindex my current index in the newly created index
  • delete old index and set alias to new index

The dynamic mapping for this type is set to false so I thought the removed field will just be ignored when the data is reindexed into the new index with the new mapping. So my problem is the field just gets copied into the new index although there is no mapping defined for this one. As described in the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/5.2/dynamic.html) I thought the field without any mapping would be ignored.

On the other hand a dynamic mapping set to strict would fail. Why is dynamic strict handled but dynamic false is just ignored?

Am I missing something or is there a better way to do this?

Thanks in advance

1 Like

I am experiencing the exact same issue. I need to _reindex and remove unneeded fields that are not defined in my new index's mapping.

I created an issue yesterday because I was wondering if it's some kind of bug. In the end the documentation was a little bit confusing, so they fixed it. Just read the issue, I hope this makes things more clear for you: https://github.com/elastic/elasticsearch/issues/25825

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