External versioning when using nested documents and painless scripting

Hello, we have some use cases where we were considering using external versioning since we stream data from a DynamoDB instance to our elasticsearch cluster. I was wondering if it is possible to use external versioning in a bulk request where you send nested documents with painless scripting updates.

I have yet to verify any behavior related to painless scripting, however, in regards to the nested documents point it would seem that when i try to send a bulk request of the form

{ "index": {"_id" : "${id}", "_index" : "${this.getIndexName()}", "version": ${version}, "version_type": "external", "retry_on_conflict": ${retry_on_conflict} } }
{ "script": <painless script to run> }

example response

{"took":1,"errors":true,"items":[{"index":{"_index":"<index>","_type":"_doc","_id":"<parent_id>","status":409,"error":{"type":"version_conflict_engine_exception","reason":"[<parent_id>]: version conflict, current version [6] is higher or equal to the one provided [3]","index_uuid":"zfuN3XETQ46bIXEsQnI0Zw","shard":"0","index":"<index>"}}}]}

that i'll get a versioning error since it is looking up the parent document's version rather than applying this to the version field on the nested doc i want to add. I just wanted to double check if it is possible for external versioning to be used with nested documents before i rule this approach out?

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