how to rename an index in a cluster?

前端 未结 8 1859
情话喂你
情话喂你 2020-12-07 09:48

I need to rename several indexes in a cluster (their name must be changed, I cannot use aliases).

I saw that there are no supported ways to do that,

8条回答
  •  隐瞒了意图╮
    2020-12-07 09:59

    Another different way to achieve the renaming or change the mappings for an index is to reindex using logstash. Here is a sample of the logstash 2.1 configuration:

    input {
      elasticsearch {
       hosts => ["es01.example.com", "es02.example.com"]
       index => "old-index-name"
       size => 500
       scroll => "5m"
      }
    }
    filter {
    
     mutate {
      remove_field => [ "@version" ]
     }
    
     date {
       "match" => [ "custom_timestamp", "MM/dd/YYYY HH:mm:ss" ]
       target => "@timestamp"
     }
    
    }
    output {
     elasticsearch {
       hosts => ["es01.example.com", "es02.example.com" ]
       manage_template => false
       index => "new-index-name"
     }
    }
    

提交回复
热议问题