使用logstash迁移elasticsearch

input {
    elasticsearch {
        hosts => "127.0.0.1:9200"
        index => "building"
        size => 5000
        scroll => "5m"
        docinfo => true
      }
}
filter { }

output {
    elasticsearch {
        hosts => ["127.0.0.1:9201"]
        index => "building"
        document_type => "%{[@metadata][_type]}"
        document_id => "%{[@metadata][_id]}"
    }

      # stdout { codec => rubydebug { metadata => true } }
}

 注意:如果是代理过的,可以写成:http://127.0.0.1:81/es/

补充:使用接口迁移

_reindex?wait_for_completion=false
{
  "source": {
    "remote": {
      "host": "http://127.0.0.1:9200" //待迁移的索引地址
    },
    "index": "dev_index_search_ik_smart_word_20250401",//需要迁移的索引名称
    "size": 1000
  },
  "dest": {
    "index": "dev_index_search_ik_smart_word_20250403"//目标索引名称
  }
}

 

posted @ 2021-12-27 11:22  炫舞风中  阅读(232)  评论(0)    收藏  举报