I need to rename several indexes in a cluster (their name needs to be changed, I cannot use aliases ).
I saw that there are no supported ways to do this, the closest I found to rename the index directory , I tried this in a cluster.
There are 3 machines A , B and C in the cluster, and the fragments are replicated on each of them. I disabled elasticsearch on A , renamed /var/lib/elasticsearch/security/nodes/0/indices/oldindexname to /var/lib/elasticsearch/security/nodes/0/indices/newindexname and restarted A
The cluster state was yellow, and elasticsearch did the magic to restore the correct state. After a while I ended up with
oldindexname is accessible and fully replicated (restored from B and C , I think)newindexname is available (I can search for it), but the head plugin shows that its fragments are in the โUnassignedโ state and that they are inactive (not replicated).
During security.log recovery, the following message appeared:
[2015-02-20 11:02:33,461][INFO ][gateway.local.state.meta ] [A.example.com] dangled index directory name is [newindexname], state name is [oldindexname], renaming to directory name
While newindexname is searchable, it is, of course, not in a normal state.
I returned to my previous state by deleting newindexname . The cluster returns to green without any โunassignedโ entries.
Given this, how can I rename oldindexname to newindexname in the cluster?
Note. The final solution that I have in mind is to scroll-copy oldindex into newindex and delete oldindex afterwards. It will take some time, so if there was a more direct solution, it would be great.
elasticsearch
WoJ Feb 20 '15 at 10:32 2015-02-20 10:32
source share