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


(Akshay Patil) #1

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


(Yaswanth ) #2

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


(system) #3

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