Search code examples
elasticsearchelasticsearch-pluginelasticsearch-2.0

Restore elasticsearch documents


first to say: I use elasticsearch 2.0 and had installed the delete-by-query plugin.

With this plugin I deleted a part of my documents. After this delete the documents are flagged as deleted and you can't find them anymore. To delete the documents from the disk, you must use optimize or forcemerge see here.

I don't delete the documents from disk. My problem is, after some days I recognized that I deleted some importend documents.

So my question is: can i restore the flagged documents?


Solution

  • No, you can not restore the flagged documents.

    You don't have to call forcemerge to make sure documents are deleted from disk ( It is basically used to optimize index i.e if you have lot of segments then you call forcemerge to reduce the number of segments and make search faster. Another use case is if you delete lot of documents and want to reclaim disk space quickly, then you call forcemerge)

    Documents marked deleted will be removed from disk as segment merging process is going on in background.

    You could also check how many deleted docs you have with indices segments api

    This blog will help you a lot in understanding deletion process of ES