Flag/Option for Immediate Consistency?


(Mike S Craig) #1

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


(Shay Banon) #2

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 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


(system) #3