Elasticsearch has a feature to capture snapshot of existing indices.
Plugin failed when try to re-assign alias during creating snapshot.
This problem happens at Elastic Cloud. They has been created indices snapshot at every 30 minutes.
2017-04-19 03:57:01.221 +0000 [INFO] (0001:transaction): Loaded plugin embulk-output-elasticsearch (0.4.0)
...
2017-04-19 03:57:01.621 +0000 [INFO] (0001:transaction): Using local thread executor with max_threads=4 / tasks=1
2017-04-19 03:57:03.634 +0000 [INFO] (0001:transaction): Connecting to Elasticsearch version:5.3.0
2017-04-19 03:57:03.634 +0000 [INFO] (0001:transaction): Executing plugin with 'replace' mode.
2017-04-19 03:57:03.684 +0000 [INFO] (0001:transaction): Inserting data into index[test_883b94cbc97e32a963c32330628b1eca_20170419-035700]
2017-04-19 03:57:03.747 +0000 [INFO] (0001:transaction): {done: 0 / 1, running: 0}
2017-04-19 03:57:04.226 +0000 [INFO] (0022:task-0000): Inserted 1 records
2017-04-19 03:57:04.242 +0000 [INFO] (0001:transaction): {done: 1 / 1, running: 0}
2017-04-19 03:57:04.243 +0000 [INFO] (0001:transaction): Insert completed. 1 records
2017-04-19 03:57:04.474 +0000 [INFO] (0001:transaction): Reassigned alias [test_883b94cbc97e32a963c32330628b1eca] to index[test_883b94cbc97e32a963c32330628b1eca_20170419-035700]
2017-04-19 03:57:04.531 +0000 [ERROR] (main): Response not 2xx: 400 Bad Request {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Cannot delete indices that are being snapshotted: [[test_883b94cbc97e32a963c32330628b1eca_20170419-035214/eJaT6SQBSVa28ImL_WMyNA]]. Try again after snapshot finishes or cancel the currently running snapshot."}],"type":"illegal_argument_exception","reason":"Cannot delete indices that are being snapshotted: [[test_883b94cbc97e32a963c32330628b1eca_20170419-035214/eJaT6SQBSVa28ImL_WMyNA]]. Try again after snapshot finishes or cancel the currently running snapshot."},"status":400}
org.embulk.exec.PartialExecutionException: org.eclipse.jetty.client.HttpResponseException: Response not 2xx: 400 Bad Request {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Cannot delete indices that are being snapshotted: [[test_883b94cbc97e32a963c32330628b1eca_20170419-035214/eJaT6SQBSVa28ImL_WMyNA]]. Try again after snapshot finishes or cancel the currently running snapshot."}],"type":"illegal_argument_exception","reason":"Cannot delete indices that are being snapshotted: [[test_883b94cbc97e32a963c32330628b1eca_20170419-035214/eJaT6SQBSVa28ImL_WMyNA]]. Try again after snapshot finishes or cancel the currently running snapshot."},"status":400}
Elasticsearch has a feature to capture snapshot of existing indices. Plugin failed when try to re-assign alias during creating snapshot. This problem happens at Elastic Cloud. They has been created indices snapshot at every 30 minutes.
Plugin should check snapshot progress status before delete index. And should wait when snapshot progress status is running. https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_monitoring_snapshot_restore_progress