0

EDITED I'm trying to find out how to delete data from Elasticsearch according to a criteria. I know that older versions of ElasticSearch had Delete By Query feature, but it had really serious performance issues, so it was removed. I know also for that there is a Java plugin for delete by query:

org.elasticsearch.plugin:delete-by-query:2.2.0

But I don't know if it has a better implementation of delete which has a better performance or it's the same as the old one.

Also, someone suggested using scroll to remove data, but I know how to retrieve data scrolling, not how to use scroll to remove!

Does anyone have an idea (the amount of documents to remove in a call would be huge, over 50k documents.

Thanks in advance!

Finally used this guy's third option

3
  • Are you using ES 2.2.0 ? Commented Dec 27, 2016 at 15:53
  • ES 1.7 something, and java API is 2.3.5 Commented Dec 27, 2016 at 17:48
  • I don't know, for instance, how to do something like this: curl -XDELETE localhost:9200/_search/scroll -d ' { "scroll_id" : ["c2Nhbjs2OzM0NDg1ODpzRlBLc0FXNlNyNm5JWUc1"] }' but with the API. Commented Dec 27, 2016 at 17:53

1 Answer 1

1

You are correct that you want to use the scroll/scan. Here are the steps:

  1. begin a new scroll/scan
  2. Get next N records
  3. Take the IDs from each record and do a BulkDelete of those IDs
  4. go back to step 2

So you don't delete exactly using the scroll/scan, you just use that as a tool to get all the IDs for the records that you want to delete. In this way you're only deleting N records at a time and not all 50,000 in 1 chunk (which would cause you all kinds of problems).

Sign up to request clarification or add additional context in comments.

1 Comment

I did exactly that, thanks a lot! And sorry for delay replying!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.