I have upgraded my elasticsearch
to 2.0 version
in my rails 4.2.7
app and am trying to delete all index data using delete-by-query plugin. How can i achieve this?
i was using delete_by_query method like this
Elasticsearch::Model.client
.delete_by_query(index: index_klass.index_name,
body: {query: {match_all: {}}})
But this is deprecated in ES 2.X versions. so how can i use plugin to do this. thanks in advance.
You have two solutions:
Thereafter, you code will work again.
Instead of deleting all the data in an index, I strongly suggest deleting the entire index and re-creating it .
Deleting the documents will mark them as deleted, but not actually physically deleting them from disk. When the automatic merging process of Elasticsearch happens then those will actually be deleted. But, the merging process will consider certain segment files for deletions only and most certainly you will still have disk space being used by an index which has no documents. More about segments' merging: https://www.elastic.co/guide/en/elasticsearch/guide/current/merge-process.html and more about the deletion of these documents at merge time - https://www.elastic.co/blog/lucenes-handling-of-deleted-documents
So, you should much much better by simply deleting the index and recreating it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.