elasticsearch: how to free store size after deleting documents

前端 未结 4 737
旧时难觅i
旧时难觅i 2020-12-07 16:24

On my elasticsearch server: total documents: 3 million, total size: 3.6G Then, I delete about 2.8 millions documents: total documents: about 0.13 million, total size: 3.6G

4条回答
  •  盖世英雄少女心
    2020-12-07 17:00

    In the current elasticsearch version(7.5),

    1. To optimize all indices:

      POST /_forcemerge?only_expunge_deletes=true

    2. To optimize single index

      POST /twitter/_forcemerge?only_expunge_deletes=true , where twitter is the index

    3. To optimize several indices

      POST /twitter,facebook/_forcemerge?only_expunge_deletes=true , where twitter and facebook are the indices

    Reference: https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-forcemerge.html#indices-forcemerge

提交回复
热议问题