How to delete all documents present in the index without deleting the Index and its mapping

I have index logstash-test of type logs I just want to delete documents present in it.

you can try delete_by_query . Try the below if ur ES is 5.x

POST logstash-test/logs/_delete_by_query?conflicts=proceed
{
  "query": {
    "match_all": {}
  }
}

If you are having 2.x then you use this

DELETE /logstash-test/logs/_query
   {
      "query": {
        "match_all": {}
      }
    }

Thanks

3 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.