elastic4s - can elasticsearch guarantee correctiveness when updating one doc at high frequency? -


i have been working on project involves massive updates elasticsearch , found when updating applied 1 single doc @ high frequency, consistence can not guaranteed.

for each update, how do(scala code). notice that, have explicitly remove origin fields , replace new 1 because 'merge' not want(_update merge in fact in elasticsearch).

def replacefields(alarmid: string, newfields: map[string, any]): future[bulkresponse] = { def removefield(fieldname: string): updatedefinition = {   log.info("script: " + s"""ctx._source.remove("${fieldname}")""")   update id alarmid in indextype script s"""ctx._source.remove("${fieldname}")""" }  client.execute {   bulk(     {newfields.tolist.map(ele => removefield(ele._1)) :+       {update id alarmid in indextype doc (newfields)}} : _*   ) }} 

it cannot. can increase write quorum level (see undestanding write_consistency , quorum rule of elasticsearch discussion around this; see docs https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-index_.html#index-consistency) , closer. elasticsearch not have linearizability guarantees (eg https://aphyr.com/posts/317-jepsen-elasticsearch examples , https://aphyr.com/posts/313-strong-consistency-models definitions) , it's not difficult cook scenarios in es not consistent.

that being said, tends consistent of time. in high update environment, you're gonna putting lot of gc pressure on jvm clean out old docs. assume know how updates work under hood in es but, in case not, it's worth paying attention https://www.elastic.co/guide/en/elasticsearch/reference/current/_updating_documents.html


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -