if your target cluster is on a somewhat recent version of Elasticsearch (5.0 or better), you can use reindex-from-remote without writing any code. Alternatively, there is the Reindex helper in the Elasticsearch Python client which should greatly simplify your task.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.