What is the proper way to handle conflicts in "scripted_upsert"?

(Matija Bruncic) #1

I'm trying to write script using "scripted_upsert" flag on ES 2.3.4. I'm wondering how should I handle external versions.

  • Is it a good practice to verify versions in a script?
  • If it's not a good practice, how to verify external versions using scripted_upsert?
  • Can there be any concurrent problems doing it in a script?

For example, my document contains "Ver" field that contains external version. And this is my script: https://gist.github.com/mats990/39de4f28bd3666374553508ef61cb601. Along with other document fields I'm sending "Ver" as a external param to script.
It seems to me that all of these problems would disappear if I switch to internal version but unfortunately I cannot, and ES is not accepting external version in update API:

Validation Failed: 1: version type [EXTERNAL] is not supported by the update API;

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.