Delete all documents from index/type without deleting type

后端 未结 15 492
耶瑟儿~
耶瑟儿~ 2020-12-04 09:45

I know one can delete all documents from a certain type via deleteByQuery.

Example:

curl -XDELETE \'http://localhost:9200/twitter/tweet/_query\' -d \         


        
15条回答
  •  攒了一身酷
    2020-12-04 10:31

    Torsten Engelbrecht's comment in John Petrones answer expanded:

    curl -XDELETE 'http://localhost:9200/twitter/tweet/_query' -d 
      '{
          "query": 
          {
              "match_all": {}
          }
       }'
    

    (I did not want to edit John's reply, since it got upvotes and is set as answer, and I might have introduced an error)

提交回复
热议问题