# Updating one nested object

**URL:** <https://discuss.elastic.co/t/updating-one-nested-object/135166>\
**Category:** Elasticsearch\
**Created:** [June 8, 2018, 1:53pm UTC](https://discuss.elastic.co/t/updating-one-nested-object/135166 "2018-06-08T13:53:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carasel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carasel/32/51435_2.png) [@carasel](https://discuss.elastic.co/u/carasel)\
**Post date:** [June 8, 2018, 1:53pm UTC](https://discuss.elastic.co/t/updating-one-nested-object/135166/1 "2018-06-08T13:53:25Z")

</div>

I have an index of documents containing an array of objects (nested). I am aware that the normal way to update this would be to query to get the array, update the object I want to update, then replace the entire array in a partial update.

There are occasions where a lot of updates will be happening to the nested objects, so I don't want to update the entire array, in case the query for a second update happens just before the update for the first update.

Is it possible to only update one nested object in the array, without replacing the others as well?

---

<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:** [June 8, 2018, 2:02pm UTC](https://discuss.elastic.co/t/updating-one-nested-object/135166/2 "2018-06-08T14:02:52Z")

</div>

No matter what you update in a nested document, all parts of it are reindexed behind the scenes. Frequent updates to large nested documents can therefore get very expensive.

---

<div class="post-metadata">

**Author:** ![carasel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carasel/32/51435_2.png) [@carasel](https://discuss.elastic.co/u/carasel)\
**Post date:** [June 8, 2018, 2:10pm UTC](https://discuss.elastic.co/t/updating-one-nested-object/135166/3 "2018-06-08T14:10:23Z")

</div>

These updates aren't really frequent, it's just that when one update happens, others are likely to happen at the same time. Most of the time there are no updates at all.

---

<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:** [July 6, 2018, 2:21pm UTC](https://discuss.elastic.co/t/updating-one-nested-object/135166/4 "2018-07-06T14:21:04Z")

</div>

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