ElasticSearch Delete bulk items

176 views Asked by At

I'd like to delete all the documents of a certain type.

But this only works on versions 1.0 and higher:

curl -XDELETE 'http://localhost:9200/index/type/_query?pretty' -d 
'{
    "query" : {
        "bool" : {
            "must" : [
                {
                    "match_all" : {} 
                } 
            ] 
        } 
    }
}'

I tried this on ES v1.4.x and it works fine. It's when I run in on ES v0.90.13 where it fails. Any help would be appreciated.

1

There are 1 answers

0
keety On BEST ANSWER

From the documentation looks like for elasticsearch verserion 0.90x the delete by query should not be nested in query term :

i.e the above query should be as follows :

curl -XDELETE 'http://localhost:9200/index/type/_query?pretty' -d 
'{
        "bool" : {
            "must" : [
                {
                    "match_all" : {} 
                } 
            ] 
        } 
  }'

However for version 1.X documentation does mention that for delete by query the query should be nested inside a query similar to search api.

This is mentioned in the breaking changes of 1.0 release