# How to know the internal mechanism of elasticsearch when a document is updated?

**URL:** <https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745>\
**Category:** Elasticsearch\
**Created:** [October 17, 2018, 4:05am UTC](https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745 "2018-10-17T04:05:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikhil.k](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@nikhil.k](https://discuss.elastic.co/u/nikhil.k)\
**Post date:** [October 17, 2018, 4:05am UTC](https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745/1 "2018-10-17T04:05:07Z")

</div>

Hi All,

Elasticsearch Version: 5.4.3

1. I'm updating a document in elasticsearch using UPDATE API

Command: curl -X POST "node1:9200/index1/external/1/\_update?pretty" -H 'Content-Type: application/json' -d'  
{  
"doc": { "name": "Elastic" }  
}'

> Whenever we do an update, Elasticsearch deletes the old document and then indexes a new document with the update applied to it in one shot.

I have been following the below link: -  
Link: [Updating Documents | Elasticsearch Reference [5.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/gs-update-docs.html)

No logs are generating for deleting the old document (related files). Only logs for updating the document are being generated (such as writing the translog files at the time of updating document).

Please let me know the tool or any method to understand the internal behaviour of elasticsearch when the document is updated

Regards  
Nikhil Kapoor

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 17, 2018, 7:06am UTC](https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745/2 "2018-10-17T07:06:04Z")

</div>

This is all done by Apache Lucene under the hood, so your best bet is to properly understand how lucene works. [https://lucene.apache.org/core/7\_5\_0/index.html](https://lucene.apache.org/core/7_5_0/index.html) is a good start for this.

From an ES point of view the [TransportUpdateAction](https://github.com/elastic/elasticsearch/blob/6.4/server/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java) would be a good start.

--Alex

---

<div class="post-metadata">

**Author:** ![nikhil.k](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@nikhil.k](https://discuss.elastic.co/u/nikhil.k)\
**Post date:** [October 17, 2018, 10:53am UTC](https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745/3 "2018-10-17T10:53:51Z")

</div>

Thanks @spinscale for the response.

---

<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 14, 2018, 10:53am UTC](https://discuss.elastic.co/t/how-to-know-the-internal-mechanism-of-elasticsearch-when-a-document-is-updated/152745/4 "2018-11-14T10:53:58Z")

</div>

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