# Reduce update\_by\_query memory use

**URL:** <https://discuss.elastic.co/t/reduce-update-by-query-memory-use/225381>\
**Category:** Elasticsearch\
**Created:** [March 27, 2020, 9:55am UTC](https://discuss.elastic.co/t/reduce-update-by-query-memory-use/225381 "2020-03-27T09:55:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesus\_Rodriguez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesus_rodriguez/32/50103_2.png) [@Jesus\_Rodriguez](https://discuss.elastic.co/u/Jesus_Rodriguez)\
**Post date:** [March 27, 2020, 9:55am UTC](https://discuss.elastic.co/t/reduce-update-by-query-memory-use/225381/1 "2020-03-27T09:55:46Z")

</div>

Hi.

In one of the use cases I currently have for Elastic I have an index with relatively large documents. Initially, we chose to go with update\_by\_query. However, we recently had an OOM problem caused by one of those updates, and when checking the stack I saw that the full document was being loaded in memory.

I have tried to solve this by adding a \_source filter to the update\_by\_query, but that causes every field not included in the source filter to go away on reindexing. Is there any way to reduce the number of fields loaded in the hits without deleting the excluded fields from the original document?

Thanks!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 29, 2020, 1:57pm UTC](https://discuss.elastic.co/t/reduce-update-by-query-memory-use/225381/2 "2020-03-29T13:57:54Z")

</div>

Elasticsearch need to reindex the whole document even if your processing or criteria only touches a few fields, so I believe the answer is no.

---

<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:** [April 26, 2020, 1:57pm UTC](https://discuss.elastic.co/t/reduce-update-by-query-memory-use/225381/3 "2020-04-26T13:57:55Z")

</div>

Closed on April 26, 2020, 1:57pm UTC

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