2014-12-01 124 views
0

我想刪除某個類型的所有文檔。ElasticSearch刪除批量項目

但這僅適用於1.0及更高版本:

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

我想這對ES v1.4.x並能正常工作。這是我在ES v0.90.13上運行失敗的地方。 任何幫助,將不勝感激。

回答

1

從文檔看起來像elasticsearch verserion 0.90x的delete by query不應該被嵌套查詢詞:

即上面查詢應該如下:

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

然而,對於1.x版本文檔確實提到,對於delete by query,查詢應嵌套在類似於搜索api的查詢中。

這是在突破1.0 release