# How Documents read and write work in Elasticsearch If we doing this on the same document simultaneously?

**URL:** <https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139>\
**Category:** Elasticsearch\
**Created:** [March 22, 2018, 8:44am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139 "2018-03-22T08:44:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)\
**Post date:** [March 22, 2018, 8:44am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139/1 "2018-03-22T08:44:05Z")

</div>

Hi,

I'm new to Elasticsearch.I want to know how Read and Write operation simultaneously works in Elasticsearch.

Thanks!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 22, 2018, 9:00am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139/2 "2018-03-22T09:00:01Z")

</div>

It works well. It works well.

What exactly is your concern?

---

<div class="post-metadata">

**Author:** ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)\
**Post date:** [March 22, 2018, 9:22am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139/3 "2018-03-22T09:22:26Z")

</div>

Hi,

I want to know if we are updating any document(write operation) and at the same time someone performing a search (read operation) on the same document. In such case how read and write operation works? search result gets newly updated response or gets the old response? is any latency while performing read and write operation simultaneously? How it's work internally?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 22, 2018, 9:39am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139/4 "2018-03-22T09:39:37Z")

</div>

So search is delayed by 1 second max by default (see refresh in documentation).

The CRUD API is realtime.

> if we are updating any document(write operation) and at the same time someone performing a search (read operation) on the same document

That will work well. The user will see probably the old version of the document when searching while another user is updating the document.

> search result gets newly updated response or gets the old response?

After 1s search response will be updated if you run the search again.

I hope this clarified a bit.

I'd recommend reading this book: [Getting Started | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/getting-started.html)

It's a bit outdated but most of the questions you are asking are answered correctly there. To name a few of chapters:

- [Data In, Data Out | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/data-in-data-out.html)
- [Creating, Indexing, and Deleting a Document | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/distrib-write.html)
- [Near Real-Time Search | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/near-real-time.html)

---

<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:** [April 19, 2018, 9:39am UTC](https://discuss.elastic.co/t/how-documents-read-and-write-work-in-elasticsearch-if-we-doing-this-on-the-same-document-simultaneously/125139/5 "2018-04-19T09:39:47Z")

</div>

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