# Deletion of indexed documents while doing the indexing with action set to index

**URL:** <https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846>\
**Category:** Logstash\
**Created:** [October 13, 2020, 6:21am UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846 "2020-10-13T06:21:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [October 13, 2020, 6:21am UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846/1 "2020-10-13T06:21:44Z")

</div>

I have seen a peculiar behavior while using the logstash JDBC input plugin and Elasticsearch output plugin.

Initial indexing has been completed and was trying to do the partial update for few columns.  
When I have sent only few columns (Not all) for updating the existing document in elasticsearch, I see that those documents are getting deleted. This is with the default value of index for action parameter of elasticsearch output.

Ultimately I have used action as update to have the partial update done successfully.

But it is very strange to see that documents gets deleted when few fields have been sent to elasticsearch with action set to index.

Anyone has faced this issue? Any idea why this behavior. (Version 7.6.2)

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 13, 2020, 4:00pm UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846/2 "2020-10-13T16:00:33Z")

</div>

If you are using "index" and setting the document\_id then a new document will completely overwrite an existing document. Any columns you do not supply in the new document will not be saved from the old document.

---

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [October 13, 2020, 5:33pm UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846/3 "2020-10-13T17:33:41Z")

</div>

Yes. That was what I was expecting when action is set to index. But when few of the columns are not supplied the documents are getting deleted from the index.

---

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [October 20, 2020, 9:07am UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846/4 "2020-10-20T09:07:30Z")

</div>

Can someone explain the behavior when action is set to index and action is set to update, how these requests will be treated internally?

---

<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 17, 2020, 9:07am UTC](https://discuss.elastic.co/t/deletion-of-indexed-documents-while-doing-the-indexing-with-action-set-to-index/251846/5 "2020-11-17T09:07:30Z")

</div>

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