ElasticSearch and NEST: How do you purge all documents from an index?

后端 未结 4 773
无人及你
无人及你 2021-01-07 23:06

I know how to delete an entire ElasticSearch index, but how do you purge all documents from an index?

My Motivation: I\'d like to have a \"ReIndex\" method that purg

4条回答
  •  情书的邮戳
    2021-01-07 23:20

    $ curl -XPOST localhost:9200/myindex/_optimize ....

    The optimization process will clean all your softdeletes done by you by delete by query.

    We are also facing a simillar problem where we deletes a lot of documents.Actually we move lot of documents from one index to other as we have sharded data by date. But as ES doesn't support moving of data from one index to other.

    But optimization, is a costly operation as it consumes a lot of IO seeks. If you just want to do purge just for deletes I guess then you can utilize "only_expunge_deletes" flag to merge segments with deletes only.

    http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-optimize.html

提交回复
热议问题