I've recently had to update the type-mapping for ~30 indices, changing several fields from text → keyword .
I now need to do this again, and am wondering if there is an easier method than the one shown below.
We currently have the frustrating proceedure of:
- Posting our new index mapping matching the pattern 'primary-'
- Manually reindexing each "primary" index to a "swap" index with the new mapping applied
primary-2018-04-04 → swap-primary-2018-04-04 primary-2018-04-05 → swap-primary-2018-04-05 . . . primary-2018-04-20 → swap-primary-2018-04-20
- Deleteing each "primary-*" index
- Post an alias mapping each "swap-primary-*" back to its "primary-*" name
Firstly, is there any equivalent single '_reindex' command that will at map each "primary-" index to a corresponding "swap-primary-" index for us in one go? We could automate this using the ElasticSearch API's, but I'd rather not if there's a built-in way of doing this.
Secondly, is it possible to change mappings for text fields → keyword fields 'in place'? I understand that in-place mapping updates are generally forbade, but the raw data needed for this field is present in _source. If not, I'd love to see in-place field reindexing based on _source be added in the future.
Thanks for any help you can offer,
 We don't use the default template-mapping as we have a worryingly large field-count, so having a '.keyword' duplicate for each text field would double this count. We do control this count using "enabled:false" & similar tools; I mention it only to point out duplicating fields under a different mapping would not solve this problem for us.