简体   繁体   中英

Copying current index into new index to use updated mapping/index template (ElasticSearch)

I've recently been stuck in some issues where I had the incorrect mapping for a given index, so I had to create proper index template (or simply a mapping in some cases) although I'm aware the mappings only take affect on new indexes at that point. I would like to know how to copy over the data of an existing index to a new index. I've read a few things mentioning scan and scroll although I can't seem to find any concrete examples of how to do this.

Any help with this would be appreciated!

Thanks

Hi I have created an application that can help you to do just this. If you do not like the application you can have a look at the code as well and just copy what you need:

https://github.com/jettro/maintain-elastic

Have a look at the following two classes to see what to do:
https://github.com/jettro/maintain-elastic/.../IndexCreator.java
https://github.com/jettro/maintain-elastic/.../ScrollAndBulkIndexContentCopier.java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM