0

I am trying to delete data of particular type from Elasticsearch. I am using the Sense plugin within Chrome to execute my delete command. When I execute the command to delete index, it works for id, but not for type. In Sense I used:

  • DELETE /index
    • It deleted all data for that index.
  • DELETE /index/type/id
    • It delete data of that id.
  • DELETE /index/type
    • gives error of No handler.

Than I also tried curl commands via Cygwin to do same task it was not working, but it gave me a message about unknown curl. Please help me to know how to delete data of particular type.

1
  • Richa is offering the right solution. As a side note, Cygwin does not install curl by default, so you need to install it before it will work. The reason that DELETE /index/type exclaims that there is "No handler" is because the delete API only expects {index}/{type}/{id} or {index} as of ES 2.0. Commented Jul 5, 2016 at 15:51

1 Answer 1

1

It seems you are using Elasticsearch version 2.x. In ES 2.x it is not allowed delete a particular type. See this.

You can use delete by query plugin to delete a particular type.

Install delete-by-query plugin using

sudo bin/plugin install delete-by-query

And then run

DELETE /index/type/_query

This would delete the documents of that particular type.

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

6 Comments

You can use the delete by query plugin to effectively delete a particular type. Note that its mappings will survive the operation.
You should show the example in your answer incase the links break. (I didn't downvote because those links should survive for awhile, but the breaking changes link will definitely break eventually due to current being in it)
@pickypg.Thnx for your comment. The answer is delete by query plugin and I have added that in my answer. So what else should be added in it? Please explain..
Literally show the example of how to install it and how to then use it: bin/plugin install delete-by-query and DELETE /index/type/_query
@pickypg: Thnx for telling me the improvement. Edited my answer
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.