# Flag/Option for Immediate Consistency?

**URL:** <https://discuss.elastic.co/t/flag-option-for-immediate-consistency/6444>\
**Category:** Elasticsearch\
**Created:** [January 19, 2012, 9:37pm UTC](https://discuss.elastic.co/t/flag-option-for-immediate-consistency/6444 "2012-01-19T21:37:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_S\_Craig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_s_craig/32/3015_2.png) [@Mike\_S\_Craig](https://discuss.elastic.co/u/Mike_S_Craig)\
**Post date:** [January 19, 2012, 9:37pm UTC](https://discuss.elastic.co/t/flag-option-for-immediate-consistency/6444/1 "2012-01-19T21:37:35Z")

</div>

I've noticed that even with a single-node setup, writes/updates to  
elasticsearch are not immediately consistent. Is this expected? And  
assuming it is, can I set a flag to demand immediate consistency (presuming  
with some kind of performance penalty)?

Cheers,  
Mike Craig

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 19, 2012, 11:09pm UTC](https://discuss.elastic.co/t/flag-option-for-immediate-consistency/6444/2 "2012-01-19T23:09:28Z")

</div>

To paraphrase on the great Inigo Montoya, I am not sure consistency means  
what you think it means :). When you index a doc, its there. If you kill -9  
the node after you index the doc, it will be there. If you do a get (thanks  
to the real time get feature), you will get the just indexed doc. More  
over, you can actually do optimistic versioning with elasticsearch like put  
if absent, or update/delete only if it has a specific version.

What you see, I think, is that when you search right after you indexed a  
document, you don't get that document. This is because the search is not  
real time, its near real time. By default, changes to the index are  
refreshed every 1 second.

The refresh interval can be changed (index.refresh\_interval), even  
dynamically on a live index using the update settings API. You can also  
send a refresh command (see the refresh API) to the index to refresh the  
data "now". Last, you can have a flag on the index/delete request to  
refresh the index after it has been performed (but that can get heavy,  
depending on your workload).

On Thu, Jan 19, 2012 at 11:37 PM, Michael Craig [mkscrg@gmail.com](mailto:mkscrg@gmail.com) wrote:

> I've noticed that even with a single-node setup, writes/updates to  
> elasticsearch are not immediately consistent. Is this expected? And  
> assuming it is, can I set a flag to demand immediate consistency (presuming  
> with some kind of performance penalty)?
> 
> Cheers,  
> Mike Craig

---

<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:** [July 6, 2017, 3:42am UTC](https://discuss.elastic.co/t/flag-option-for-immediate-consistency/6444/3 "2017-07-06T03:42:03Z")

</div>


