# Doc\_as\_upsert but don't deleted nested

**URL:** <https://discuss.elastic.co/t/doc-as-upsert-but-dont-deleted-nested/287564>\
**Category:** Elasticsearch\
**Created:** [October 25, 2021, 10:51am UTC](https://discuss.elastic.co/t/doc-as-upsert-but-dont-deleted-nested/287564 "2021-10-25T10:51:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grant\_Donovan1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grant_donovan1/32/45582_2.png) [@Grant\_Donovan1](https://discuss.elastic.co/u/Grant_Donovan1)\
**Post date:** [October 25, 2021, 10:51am UTC](https://discuss.elastic.co/t/doc-as-upsert-but-dont-deleted-nested/287564/1 "2021-10-25T10:51:16Z")

</div>

I am using the doc\_as\_upsert to update my document if it already exists, for example

```auto
 {
   "doc": {
     "apple": "new_name",
     "test_list": [
       {
         "value": "first value group 1",
         "value_set": {
           "name": "set 1"
         }
       },
       {
         "value": "first value group 2",
         "value_set": {
           "name": "set 2"
         }
       }
     ]
   },
   "doc_as_upsert": true
 }

```

That works, now if I send

```auto
 {
   "doc": {
     "apple": "new_name",
     "test_list": [
       {
         "value": "first value group 1",
         "value_set": {
           "name": "set 1"
         }
       },
       {
         "value": "first value group 2"
        }
     ]
   },
   "doc_as_upsert": true
 }

```

It removes the second value sent from the record (I sent nothing). It is possible to keep that intact in the index?

Thanks

Grant

---

<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:** [November 22, 2021, 10:51am UTC](https://discuss.elastic.co/t/doc-as-upsert-but-dont-deleted-nested/287564/2 "2021-11-22T10:51:32Z")

</div>

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