Delete records from Elasticsearch by query

elasticsearch

Solution

Prior to 1.0, the delete by query does not use filters. The syntax goes directly to what is the "query" block in the search API. You need to use the range query instead.

curl -XDELETE 'http://localhost:9200/twitter/twit/_query' -d '
{
    "range" : {
        "date_time" : { "from" : "2012-10-01 00:00:01", "to" : "2013-05-01 11:59:59"}
    }
}'

Problem

I am trying to delete specific date records from Elasticsearch. My query is the following: ``` curl -XDELETE 'http://localhost:9200/twitter/twit/_query' -d ' { "filter" : { "range" : { "date_time" : { "from" : "2012-10-01 00:00:01", "to" : "2013-05-01 11:59:59"} } } }' ``` but it is not deleting any records. so it is correct one or are there some other methods to delete records.

Original source