I'm having an issue and I would like to understand what is going on. I have a Dao class that executes the following code:
listOne.add(peanut); UpdateRequest updateRequest = new UpdateRequest(); updateRequest.index(aux.getIndex()); updateRequest.type(org.core.database.json.Element.classType); updateRequest.id(elementId.toString()); updateRequest.doc("listOne",listOne); element.setListOne(listOne); // Retry 3 times before failing the update updateRequest.retryOnConflict(3); client.update(updateRequest).get();
The thing is.. imagine that I have 10 elements to be updated. It will run this Dao 10 times. The first 1/2 records are not properly updated, but the rest is fine.
I tried to print out the list after and before the update, and in some cases, it will update, and it will get the previous list (already updated). But sometimes the things are not ok, and it won't get the list updated. Probably something related to timings / delay?
Do you know what is the root cause?