Re: Disable increment of version counter on some update operations possible?
Thanks for your effort, Brian. I'll think about this (I'm working with node.js not with Java anyway), but I already opened an issue for this (https://github.com/elasticsearch/elasticsearch/issues/4791). -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5b75b820-53c4-440c-8144-5427381f21e9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Disable increment of version counter on some update operations possible?
Hi Jörg, as I understand, even with external versioning its not possible to update a doc *without changing/not incrementing* the version number at all. 1. User A loads DOC123 with version 20 and locally starts editing critical fields 2. User B simply loads DOC123 to view/read only. A view counter will be incremented, so also the version number will be set to 21 (or something higher with external versioning, but not to 20 again) 3. User A tries to send the updates from (1) with version number 20 to ensure he has the current version and update will fail, cause version number has changed Thanks Joa -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b691324b-7955-4379-b014-ee9d27a29e38%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Disable increment of version counter on some update operations possible?
Thanks Clinton -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e11afdd7-9ee8-4038-b382-e12f6d6dbdfb%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Disable increment of version counter on some update operations possible?
Not sure I fully understand the use case but AFAIK you can not keep the same version. If needed, you can try to manage version by yourself using external versioning: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning Note sure it helps though. -- David Pilato | Technical Advocate | Elasticsearch.com @dadoonet | @elasticsearchfr Le 17 janvier 2014 at 14:13:19, joa (joafeldm...@gmail.com) a écrit: Is it possible to disable the increment of the version counter on some update operations? I've a views counter which is updated whenever user opens a file in ma app. body: { script: 'ctx._source.views += 1',} I don't want this to affect the version number, cause when some other user is doing updates on other document attributes, updates could not be saved due to version conflict. On the other hand I'd like to use the versioning feature to make sure multiple users are overriding their changes. (except from the views field) Thanks, Joa -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ea2893c7-464e-4de3-ac5a-01520eb293dd%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52d9456f.4f4ef005.dc5%40MacBook-Air-de-David.local. For more options, visit https://groups.google.com/groups/opt_out.
Re: Disable increment of version counter on some update operations possible?
Not a lot of code at all. Just some code that will be a lot of fun to write. I did it with a lot more code, before I got into Jackson data binding. But I wanted a generic Document class that adapted to a schema; you won't need all that. First, get Jackson and add the following jars to your classpath: jackson-annotations-2.2.3.jar jackson-core-2.2.3.jar jackson-databind-2.2.3.jar Create a class. Let's call it Document. Using Jackson's data binding is dirt-easy and tons of fun... and super fast too. Query for your document, and using Jackson's data binding, deserialize its getSourceAsString into your Document just like that: Poof! Then add the index, type, id, and version for good measure. A pittance of code. Write a merge method to merge a source Document into a target Document. Again, very simple. Your setters might need a boolean for each internal data member to indicate it it's set or not. Or treat a null String or 0 numeric value as unset. Whatever fits your needs. Then your Document.toString method could be @Override to marshall your Document to a JSON string that matches the _source. The remaining code would be to get-by-id (GetRequest) and issue an index request. I don't think it would make sense to build this into Elasticsearch; ES doesn't know about your documents and what a merge might mean, what field update rules you might require, or even what fields and their types exist in your documents. And suppressing the versioning would then defeat Elasticsearch's ability to detect when one update is trashing the changes made by another update. Without the ability to lock a document and wrap updates and queries with an ACID transaction (which ES won't ever pollute itself with), the existing (and really awesome) versioning behavior gives you everything you need to do the job much more easily. And Elasticsearch along with adding in Jackson data binding make writing it yourself an effort that will bring joy and success to you after perhaps a day or two. Well, it did for me! Have fun! Brian -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7633d955-0fb5-49b5-881c-03dde3c3aa99%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Disable increment of version counter on some update operations possible?
Also, see https://groups.google.com/d/topic/elasticsearch/1152jRW_rQg/discussion for how easy it is to issue an index request in Java. Hardly any code at all. (Keep in mind the method name mismatch between the actual code and the on-line docs, but those issues are clearly shown in this post). And http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/index_.html#beanscontains an example of how easy it is to write the code to covert between a Java object and a JSON string. Then Google for the annotations you'll need to customize Jackson data binding for your document class. And if you run into any data binding questions related to this, feel free to ask me. Brian -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2ed979e7-cb01-4f48-a670-68288d36d06d%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.