Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to reindex multiple indices in ElasticSearch

Tags:

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.

like image 701
SSG Avatar asked May 24 '17 18:05

SSG


1 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

like image 112
Thiago Falcao Avatar answered Sep 23 '22 11:09

Thiago Falcao