# How to use bulk api for partial updates of documents that may not exist?

**URL:** <https://discuss.elastic.co/t/how-to-use-bulk-api-for-partial-updates-of-documents-that-may-not-exist/230722>\
**Category:** Elasticsearch\
**Created:** [May 1, 2020, 2:29pm UTC](https://discuss.elastic.co/t/how-to-use-bulk-api-for-partial-updates-of-documents-that-may-not-exist/230722 "2020-05-01T14:29:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmavilia\_w](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rmavilia_w/32/67222_2.png) [@rmavilia\_w](https://discuss.elastic.co/u/rmavilia_w)\
**Post date:** [May 1, 2020, 2:29pm UTC](https://discuss.elastic.co/t/how-to-use-bulk-api-for-partial-updates-of-documents-that-may-not-exist/230722/1 "2020-05-01T14:29:49Z")

</div>

I am trying to use the `_bulk` endpoint with `update` requests but I have a few different data pipelines that are going to be putting together the pieces of my documents. I have realized that the reason my updates aren't working is because I have no documents yet and, unlike the updateRequest in a bulkRequest for the high level REST client, when you use the `update` request for a plain `_bulk` endpoint the document needs to already be created.

Is this a setting that I can change or something I can add to my request? I have 3 different pipelines so I would really rather use partial updates that just get created when the document does not exist. Let me know if more context is needed, thanks!

---

<div class="post-metadata">

**Author:** ![rmavilia\_w](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rmavilia_w/32/67222_2.png) [@rmavilia\_w](https://discuss.elastic.co/u/rmavilia_w)\
**Post date:** [May 1, 2020, 3:33pm UTC](https://discuss.elastic.co/t/how-to-use-bulk-api-for-partial-updates-of-documents-that-may-not-exist/230722/2 "2020-05-01T15:33:06Z")

</div>

Found out I need to use the `"doc_as_upsert" : true` as part of my docs 🙂

---

<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 29, 2020, 3:33pm UTC](https://discuss.elastic.co/t/how-to-use-bulk-api-for-partial-updates-of-documents-that-may-not-exist/230722/3 "2020-05-29T15:33:07Z")

</div>

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