# Forcemerge API max\_num\_segments=1 ok for my index?

**URL:** <https://discuss.elastic.co/t/forcemerge-api-max-num-segments-1-ok-for-my-index/177215>\
**Category:** Elasticsearch\
**Created:** [April 17, 2019, 7:34am UTC](https://discuss.elastic.co/t/forcemerge-api-max-num-segments-1-ok-for-my-index/177215 "2019-04-17T07:34:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilip\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dilip_kumar/32/15459_2.png) [@Dilip\_Kumar](https://discuss.elastic.co/u/Dilip_Kumar)\
**Post date:** [April 17, 2019, 7:34am UTC](https://discuss.elastic.co/t/forcemerge-api-max-num-segments-1-ok-for-my-index/177215/1 "2019-04-17T07:34:23Z")

</div>

I have index (myindex) in cluster with two nodes, i am deleting some records with delete\_by\_query. Now i want to use  
`curl -XPOST 192.168.1.111:9200/myindex/_forcemerge?max_num_segments=1` to free disk space and mke lighter. so max\_num\_segments=1 is ok or anything else  
i should do care.  
How this API is different from `_forcemerge?only_expunge_deletes=true`  
Which one will be better and faster?

---

<div class="post-metadata">

**Author:** ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)\
**Post date:** [April 17, 2019, 2:29pm UTC](https://discuss.elastic.co/t/forcemerge-api-max-num-segments-1-ok-for-my-index/177215/2 "2019-04-17T14:29:31Z")

</div>

Force merge is recommended only to be run in read-only indices:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html)

If you still want to run it to free space I would recommend to run it with `only_expunge_deletes=true` if your segment are not read-only as it will be faster and it will only merge segments with delete documents.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 15, 2019, 2:29pm UTC](https://discuss.elastic.co/t/forcemerge-api-max-num-segments-1-ok-for-my-index/177215/3 "2019-05-15T14:29:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
