Insert aggregation results into an index
Edit the logstash.conf
file as follow
input { elasticsearch { hosts => "localhost" index => "source_index_name" type =>"index_type" query => '{Query}' size => 500 scroll => "5m" docinfo => true }}output { elasticsearch { index => "target_index_name" document_id => "%{[@metadata][_id]}" }}