0

Elastic search API is eventually consistent, in favour of query response times. Eventual consistency is not an issue as long as one can be sure of the date it is consistent with.

  • Can any elasticsearch search (API) result return the time for which it is consistant with ? or
  • Is there any way to have elasticsearch search (API) results include the time for which it is consistent with ? or
  • Would it be possible to provide a date at search query time against witch the API could either respond «unconsistent against provided date» or the result consistent with that date ?

The ultimate desired function is to be able to provide a (possibly functional) date for each bulk update/indexing step and have the search query deal with it. If not possible, the real technical update/indexing date could be enough.

Is it possible to know when a given update/synchronization among all nodes is over ?

This question went to me in the process of evaluating elasticsearch against an industrial project, after reading this

user1767316
  • 3,276
  • 3
  • 37
  • 46

1 Answers1

1

Oh, that's a lot of questions )

First of all, there's big chance that if you're facing consistency requirement/issues, you need to switch to consistent data storage. ES is great and all, but sometimes consistency is a must.

Talking about "time since last sync"/"time consistent with". From my knowledge so far, there's synced flush machinery, that gives you ability to check state of "inactive" indices via /_stats?level=shards. Not sure if its suitable for your usecase.

The thing you can do if you need consistent state is to index data with wait_for_active_shards=all, which kind of turns your index from AP to CP mode, or [occasionally] read data from master shard only with _search?preference=_primary, to make index kind of CA

Slam
  • 8,112
  • 1
  • 36
  • 44