There are many scenarios when choosing among these two options is easy like:
When you want to do conditional updates script is the winner.
In case you in the application logic only have the update part not the complete object than again script is the clear winner.
But I have a situation where I have the complete object in my hand. Out of the complete object I only want to update a very small part. So what should I use, storing the complete object or updating it via script. Which will perform better?
They'll perform mostly the same.The real overhead of an update is indexing the new document and cleaning up the tombstone of the old document on the next time its merged. The tombstones also cost IO during queries and effect the scoring so if you get too many that is trouble eventually.
The way in which the update hits the system isn't a huge part of it. My biggest bit of advice is to avoid noop updates. If you send the whole object there is a flag you can turn on to detect noops but if you send a script then the responsibility is on you.
Oh! If you go the script route make sure its parameterized or else compiling it will be overhead. If its parameterized then it is only compiled once.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.