I want to re-index all documents in elasticsearch index. Delete by query(with match_all) seems too expensive operation, so i probably drop and create the index (and call PUT the mapping again) Is there any better approach?
-
Have you checked the following doc? elastic.co/guide/en/elasticsearch/guide/current/reindex.htmlAaron– Aaron2016-02-11 14:29:54 +00:00Commented Feb 11, 2016 at 14:29
-
@Aaronmins I dont need to save the old documnets.User1234– User12342016-02-11 14:37:53 +00:00Commented Feb 11, 2016 at 14:37
-
It's not about saving old documents, it's about using scroll to retrieve the documents from the old index and bulk to publish them to the new one. You said you needed to reindex all documents so I thought it would be relevant.Aaron– Aaron2016-02-11 15:22:56 +00:00Commented Feb 11, 2016 at 15:22
Add a comment
|
1 Answer
In previous versions, you were able to delete the index mappings.
client.admin().indices().prepareDeleteMapping(indexKey)
.setType(typeKey).execute().actionGet();
Unfortunately, since version 2.1 this is not possible anymore, and you should either delete everything one by one, or simply delete the whole index.
See https://www.elastic.co/guide/en/elasticsearch/reference/2.1/indices-delete-mapping.html