# Forcemerge concerns

**URL:** <https://discuss.elastic.co/t/forcemerge-concerns/211838>\
**Category:** Elasticsearch\
**Created:** [December 13, 2019, 7:19pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838 "2019-12-13T19:19:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabioRodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabiorodrigues/32/59312_2.png) [@FabioRodrigues](https://discuss.elastic.co/u/FabioRodrigues)\
**Post date:** [December 13, 2019, 7:19pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/1 "2019-12-13T19:19:34Z")

</div>

Hi!  
I need to reduce de size of a database by shrinking one field from a document. The problem is: the size of this database is huge. Also, I need to not reduce the performance of it significantly. I'm wondering if I can reindex the document and use a \_forcemerge. BUT I saw that I can't write while doing that, so it's not a good idea. Can someone guide me to the best practice about removing versions from a document after reindex in database yet being used  
to write?

Thanks!!

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 16, 2019, 9:01am UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/2 "2019-12-16T09:01:23Z")

</div>

Where did you read that you cannot write while a merge is happening? Elasticsearch is doing merging in the background all the time while indexing happens.

---

<div class="post-metadata">

**Author:** ![FabioRodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabiorodrigues/32/59312_2.png) [@FabioRodrigues](https://discuss.elastic.co/u/FabioRodrigues)\
**Post date:** [December 16, 2019, 10:18am UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/3 "2019-12-16T10:18:58Z")

</div>

Hi there! Thanks for the answer. I read it here:  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-forcemerge.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-forcemerge.html)

 ![Screenshot_20191216-071640](https://us1.discourse-cdn.com/elastic/original/3X/d/4/d49e2ad5f2c9235c74c90f3f9e3605f18d6ecda8.png)

Anyway, do you know what is the best practice for this kind of task?  
Thank you!

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 16, 2019, 11:54am UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/4 "2019-12-16T11:54:14Z")

</div>

> the call will block until the merge is complete

This is only about the HTTP call send to Elasticsearch, not about any write operations.

If you need to remove a certain field, you should take a look at reindex or update-by-query

---

<div class="post-metadata">

**Author:** ![FabioRodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabiorodrigues/32/59312_2.png) [@FabioRodrigues](https://discuss.elastic.co/u/FabioRodrigues)\
**Post date:** [December 16, 2019, 2:46pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/5 "2019-12-16T14:46:40Z")

</div>

Actually I am more concerned about this:

"Force merge should only be called against **read-only indices**. Running force merge against a read-write index can cause very large segments to be produced (\>5Gb per segment), and the merge policy will never consider it for merging again until it mostly consists of deleted docs. This can cause very large segments to remain in the shards."

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 16, 2019, 5:02pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/6 "2019-12-16T17:02:36Z")

</div>

yes, this is an important advice. Only run force-merge if the index will not see any updates. Otherwise merges will be running at some point in the background anyway.

To me, reindex (without a forcemerge) sounds like a good idea to start with.

---

<div class="post-metadata">

**Author:** ![FabioRodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabiorodrigues/32/59312_2.png) [@FabioRodrigues](https://discuss.elastic.co/u/FabioRodrigues)\
**Post date:** [December 16, 2019, 8:11pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/7 "2019-12-16T20:11:57Z")

</div>

Thanks for the solution!  
I havent mentioned that, but my db has like 7tb of data.  
Do you still consider it a good idea?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 17, 2019, 12:10pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/8 "2019-12-17T12:10:52Z")

</div>

as usual there is no clear answer, you might need more space during reindex until save spacings kick in (especially when indexing into a new index), so you need to be sure you will be able to sustain that.

---

<div class="post-metadata">

**Author:** ![FabioRodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabiorodrigues/32/59312_2.png) [@FabioRodrigues](https://discuss.elastic.co/u/FabioRodrigues)\
**Post date:** [December 17, 2019, 4:56pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/9 "2019-12-17T16:56:22Z")

</div>

Thank you a lot!

---

<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:** [January 14, 2020, 4:56pm UTC](https://discuss.elastic.co/t/forcemerge-concerns/211838/10 "2020-01-14T16:56:26Z")

</div>

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