1

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?

3
  • Have you checked the following doc? elastic.co/guide/en/elasticsearch/guide/current/reindex.html Commented Feb 11, 2016 at 14:29
  • @Aaronmins I dont need to save the old documnets. Commented 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. Commented Feb 11, 2016 at 15:22

1 Answer 1

1

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

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

Comments

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.