Delete all documents from index/type without deleting type

后端 未结 15 505
耶瑟儿~
耶瑟儿~ 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:24

    (Reputation not high enough to comment) The second part of John Petrone's answer works - no query needed. It will delete the type and all documents contained in that type, but that can just be re-created whenever you index a new document to that type.

    Just to clarify: $ curl -XDELETE 'http://localhost:9200/twitter/tweet'

    Note: this does delete the mapping! But as mentioned before, it can be easily re-mapped by creating a new document.

提交回复
热议问题