3

I am trying to delete all document from my index and getting the following error on CURL. No handler found for uri [/logstash-2016.03.11/logevent/] and method [DELETE]

Here is my delete command on Windows command.

curl -XDELETE "http://localhost:9200/logstash-2016.03.11/logevent/"

can anybody help?

2

2 Answers 2

7
curl -XPOST "http://localhost:9200/logstash2016.03.11/logevent/_delete_by_query" -d'
{
     "query":{
          "match_all":{}
      }
}'

The delete-by-query API is new and should still be considered experimental. The API may change in ways that are not backwards compatible

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

0
3

You cannot delete a type from an index by executing a delete on the type.

To solve your problem, you have 2 solutions.

  1. If you only have a single type in your logstash index, just execute curl -XDELETE "http://localhost:9200/logstash-2016.03.11. It will delete the old index, but logstash will recreate it when it'll process the next event

  2. You install the delete by query plugin ( https://www.elastic.co/guide/en/elasticsearch/plugins/2.2/plugins-delete-by-query.html ) and run something like this :

    curl -XDELETE /logstash-2016.03.11/logevent/_query -d '
    {
      "query": { "match_all": {}}
    }'
    
2
  • Thanks for you help. Is there a good way to pass curl commands on windows. I use the command shell but typing the multi-line CURL commands is a pain there. Mar 14, 2016 at 18:30
  • Sorry I don't use Windows, but I guess you could put everything on a single line. curl -XDELETE /logstash-2016.03.11/logevent/_query -d '{"query": {"match_all": {}}}' . Also, would you mind accepting the answer if it worked for you ?
    – maximede
    Mar 14, 2016 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.