How delete data from elasticsearch according to index time

hi all:
I index data use spark, but the job failed after ran few hours, so the data is incomplete. I want to delete them that indexed in that few hours. How can I do it? Thanks.

Is all the data in one single index?
Is is mixed with other data?

If you set the document ids in your job, you can just reindex again. It will overwrite existing docs.

If you have a timestamp or a range of ids, you can use the delete by query plugin.


all data in one single index

hi David, I use automatic ID, and has no timestamp in the data, so i don't no how to filter the data use query plugin.

Is there other data in the same index? If not then just delete the index.

yes, there are much other data in the index

You are probably better of putting it into it's own index then.

For this, you will need to use the delete-by-query plugin.

Mark, thanks for your reply , but i don't know how to use the query plugin, the data has no unique feature except indexed time