Published on

Sync Elasticsearch index to another Elasticsearch using logstash

input {
  elasticsearch {
    hosts => [ "http://source_host:9200" ]
    index => "physicians"
    size => 1000
    scroll => "5m"
    docinfo => true
  }
}

output {
  elasticsearch {
    hosts => [ "http://destination_host:9200" ]
    index => "%{[@metadata][_index]}"
    document_type => "%{[@metadata][_type]}"
    document_id => "%{[@metadata][_id]}"
  }
  stdout {
    codec => "dots"
  }
}
logstash -f logstash-es-sync.conf