Best way to reindex multiple indices in ElasticSearch

Viewed 9886

I am using Elasticsearch 5.1.1 and have 500 + indices created with default mapping provided by ES.

Now we have decided to use dynamic templates. In order to apply this template/mapping to old indices I need to reindex all indices.

What is the best way to do it? Can we use Kibana for this ? Couldn't find sufficient documentation to do so.

4 Answers

Example: Reindex from a daily index to a monthly index (August)

POST _reindex?slices=10&refresh
{
  "source": {
    "index": "myindex-2019.08.*"
  },
  "dest": {
    "index": "myindex-2019.08"
  }
}

Monitor reindex task (wait until is finished)

GET _tasks?detailed=true&actions=*reindex

Check if new index was created

GET _cat/indices/myindex-2019.08*?v&s=index

You can delete old indices

DELETE myindex-2019.08.*

Source:

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

If you want to filter some field and reindex it from index you can use this.

POST _reindex { "source": { "index": "auditbeat", "query": { "match": { "agent.version": "7.6.0" } } }, "dest": { "index":"auditbeat-7.6.0" } }

Related